X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ParamSpinBox.cpp;h=febd29badbf419cdbf187edbbcf8533742bf04e6;hb=ec6769ca1253d91c847027b5d36c800d9b5ed793;hp=8b09ac9fece6ec394cf21314cd0a580084d3e274;hpb=1a0d48211014d96db9125fe973eacbae895c4490;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index 8b09ac9fe..febd29bad 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -73,7 +74,6 @@ void ModuleBase_ParamSpinBox::connectSignalsAndSlots() */ void ModuleBase_ParamSpinBox::onTextChanged(const QString& text) { - ModuleBase_DoubleSpinBox::onTextChanged(text); myTextValue = text; } @@ -85,11 +85,11 @@ void ModuleBase_ParamSpinBox::onTextChanged(const QString& text) */ 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 iniiate valuesChanged signal - return theText.length(); + + // small hack: return length of the string to initiate valuesChanged signal + return qHash(theText); } QString ModuleBase_ParamSpinBox::textFromValue (double theValue) const @@ -178,10 +178,19 @@ bool ModuleBase_ParamSpinBox::hasVariable(const QString& theText) const // 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; } /*!