Source
397
397
398
398
bool SpecFitSettingsWidgetRadio::isValidEstimate( QString& peakStr,
399
399
QString& centerStr, QString& fwhmStr,
400
400
QString& fixedStr, int rowIndex ) {
401
401
bool validEstimate = true;
402
402
QDoubleValidator validator( numeric_limits<double>::min( ),
403
403
numeric_limits<double>::max( ),
404
404
10, 0 );
405
405
int pos = 0;
406
406
QString msg( "Row "+QString::number(rowIndex)+" of the initial estimate table is invalid.\n");
407
-
if ( ! validator.validate(peakStr, pos) == QValidator::Acceptable ) {
407
+
if ( validator.validate(peakStr, pos) != QValidator::Acceptable ) {
408
408
validEstimate = false;
409
409
msg.append( "Please check that the following numbers are valid:\n");
410
410
msg.append( " peak");
411
411
}
412
-
if ( !validator.validate(centerStr, pos) == QValidator::Acceptable ) {
412
+
if ( validator.validate(centerStr, pos) != QValidator::Acceptable ) {
413
413
validEstimate = false;
414
414
msg.append( "\n center");
415
415
}
416
-
if ( !validator.validate( fwhmStr, pos) == QValidator::Acceptable ) {
416
+
if ( validator.validate( fwhmStr, pos) != QValidator::Acceptable ) {
417
417
validEstimate = false;
418
418
msg.append( "\n FWHM");
419
419
}
420
420
//Check that the fixed string contains
421
421
//zero or one instance of the characters "pcf" in any order.
422
422
QRegExp fixedRe("p?c?f?|p?f?c?|c?p?f?|c?f?p?|f?c?p?|f?p?c?");
423
423
QRegExpValidator validatorFixed(fixedRe, 0 );
424
-
if ( !validatorFixed.validate(fixedStr, pos) == QValidator::Acceptable ) {
424
+
if ( validatorFixed.validate(fixedStr, pos) != QValidator::Acceptable ) {
425
425
validEstimate = false;
426
426
msg.append( "\nPlease check that the fixed string contains only the characters 'p', 'c', and 'f' at most once in any order.");
427
427
}
428
428
if ( !validEstimate ) {
429
429
Util::showUserMessage( msg, this );
430
430
}
431
431
432
432
return validEstimate;
433
433
}
434
434