From: vsv Date: Mon, 7 Sep 2015 09:30:32 +0000 (+0300) Subject: Issue #910: Do not replace text in spin box if it is not changed X-Git-Tag: V_1.4.0_beta4~99 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b873cd9cf04abd9628d0cf3b83447956fac31e16;p=modules%2Fshaper.git Issue #910: Do not replace text in spin box if it is not changed --- diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index a3cfca0a6..6ee563fc7 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -26,6 +26,9 @@ #include +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);