#include <QLocale>
#include <QRegExp>
#include <QToolTip>
+#include <QApplication>
#include <string>
#include <iostream>
*/
double ModuleBase_ParamSpinBox::valueFromText(const QString& theText) const
{
- if (!hasVariable(theText)) {
+ if (!hasVariable(theText))
return ModuleBase_DoubleSpinBox::valueFromText(theText);
- }
+
// small hack: return length of the string to initiate valuesChanged signal
return qHash(theText);
}
// QRegExp varNameMask(aDigitPattern.arg(","));
// aHasDigit = varNameMask.exactMatch(theText);
//}
- bool aHasDigit = false;
- theText.toDouble(&aHasDigit);
- return !aHasDigit;
-
+ bool isDouble = false;
+ QLocale::c().toDouble(theText, &isDouble);
+
+// theText.toDouble(&isDouble);
+// if (isDouble) {
+// QLocale aLoc; // create default locale
+// QChar aDecPnt = aLoc.decimalPoint();
+// if (aDecPnt == '.')
+// isDouble = theText.contains(aDecPnt) || (!theText.contains(','));
+// else if (aDecPnt == ',')
+// isDouble = theText.contains(aDecPnt) || (!theText.contains('.'));
+// }
+ return !isDouble;
}
/*!