]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #652: Qt can convert to double a string as with '.' as with ',', but method...
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 15 Jul 2015 06:50:48 +0000 (09:50 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 15 Jul 2015 06:51:09 +0000 (09:51 +0300)
src/ModuleBase/ModuleBase_ParamSpinBox.cpp

index 2b35449170618048bb43d1c9db729e0a3f8c275a..55543e80e1ba048f0733df1a162df6743ef44918 100644 (file)
@@ -11,6 +11,7 @@
 #include <QLocale>
 #include <QRegExp>
 #include <QToolTip>
+#include <QApplication>
 
 #include <string>
 #include <iostream>
@@ -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;
 
 }