From c8cd3cd202667884db574d6c4133a710dbc005ba Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 12 May 2010 06:14:58 +0000 Subject: [PATCH] 0020580: EDF 1169 GEOM: float number precision in dialog boxes Additional fix for the bug with very small values (pseudo-zero) --- src/Qtx/QtxDoubleSpinBox.cxx | 7 +++++++ 1 file changed, 7 insertions(+) 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 ); } /*! -- 2.39.2