From: vsv Date: Wed, 15 Jul 2015 06:50:48 +0000 (+0300) Subject: Issue #652: Qt can convert to double a string as with '.' as with ',', but method... X-Git-Tag: V_1.3.0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ec9d3e9d1a8653f9a193ebe81bad943de647ef3e;p=modules%2Fshaper.git Issue #652: Qt can convert to double a string as with '.' as with ',', but method value() of SpinBox returns non correct value if the decimal point doesn't correspond to locale. We have to check this situation. --- diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index 2b3544917..55543e80e 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -179,6 +180,14 @@ bool ModuleBase_ParamSpinBox::hasVariable(const QString& theText) const //} 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; }