]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #910: Do not replace text in spin box if it is not changed
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 7 Sep 2015 09:30:32 +0000 (12:30 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 7 Sep 2015 09:30:32 +0000 (12:30 +0300)
src/ModuleBase/ModuleBase_Tools.cpp

index a3cfca0a6089175d18a72f338a33b2ccc0d7c753..6ee563fc72214f1f39e9033cc1abd2cdd4a342c2 100755 (executable)
@@ -26,6 +26,9 @@
 
 #include <sstream>
 
+const double tolerance = 1e-7;
+
+
 namespace ModuleBase_Tools {
 
 //******************************************************************
@@ -126,7 +129,7 @@ void setSpinText(ModuleBase_ParamSpinBox* theSpin, const QString& theText)
 
 void setSpinValue(QDoubleSpinBox* theSpin, double theValue)
 {
-  if (theSpin->value() == theValue)
+  if (fabs(theSpin->value() - theValue) < tolerance)
     return;
   bool isBlocked = theSpin->blockSignals(true);
   theSpin->setValue(theValue);
@@ -135,8 +138,8 @@ void setSpinValue(QDoubleSpinBox* theSpin, double theValue)
 
 void setSpinValue(ModuleBase_ParamSpinBox* theSpin, double theValue)
 {
-  //if (theSpin->value() == theValue)
-  //  return;
+  if (fabs(theSpin->value() - theValue) < tolerance)
+    return;
   bool isBlocked = theSpin->blockSignals(true);
   theSpin->setValue(theValue);
   theSpin->blockSignals(isBlocked);