X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FModuleBase%2FModuleBase_ParamSpinBox.cpp;h=febd29badbf419cdbf187edbbcf8533742bf04e6;hb=ec6769ca1253d91c847027b5d36c800d9b5ed793;hp=55543e80e1ba048f0733df1a162df6743ef44918;hpb=ec9d3e9d1a8653f9a193ebe81bad943de647ef3e;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index 55543e80e..febd29bad 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -85,9 +85,9 @@ 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 initiate valuesChanged signal return qHash(theText); } @@ -178,18 +178,19 @@ bool ModuleBase_ParamSpinBox::hasVariable(const QString& theText) const // QRegExp varNameMask(aDigitPattern.arg(",")); // aHasDigit = varNameMask.exactMatch(theText); //} - bool aHasDigit = false; - theText.toDouble(&aHasDigit); - if (aHasDigit) { - QLocale aLoc; // create default locale - QChar aDecPnt = aLoc.decimalPoint(); - if (aDecPnt == '.') - aHasDigit = theText.contains(aDecPnt) || (!theText.contains(',')); - else if (aDecPnt == ',') - aHasDigit = theText.contains(aDecPnt) || (!theText.contains('.')); - } - 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; } /*!