From: vsr Date: Wed, 12 May 2010 06:14:58 +0000 (+0000) Subject: 0020580: EDF 1169 GEOM: float number precision in dialog boxes X-Git-Tag: V5_1_4rc2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c8cd3cd202667884db574d6c4133a710dbc005ba;p=modules%2Fgui.git 0020580: EDF 1169 GEOM: float number precision in dialog boxes Additional fix for the bug with very small values (pseudo-zero) --- diff --git a/src/Qtx/QtxDoubleSpinBox.cxx b/src/Qtx/QtxDoubleSpinBox.cxx index f0560db9b..87120b243 100644 --- a/src/Qtx/QtxDoubleSpinBox.cxx +++ b/src/Qtx/QtxDoubleSpinBox.cxx @@ -28,6 +28,8 @@ #include +const double PSEUDO_ZERO = 1.e-20; + /*! \class QtxDoubleSpinBox \brief Enhanced version of the Qt's double spin box. @@ -263,6 +265,11 @@ void QtxDoubleSpinBox::stepBy( int steps ) myCleared = false; QDoubleSpinBox::stepBy( steps ); + double tmpval = value(); + if ( qAbs( tmpval ) < PSEUDO_ZERO ) tmpval = 0.; + if ( tmpval < minimum() ) tmpval = minimum(); + else if ( tmpval > maximum() ) tmpval = maximum(); + setValue( tmpval ); } /*!