From 23257cf204f279e1f24c76194e1df1a40d977e1c Mon Sep 17 00:00:00 2001 From: ouv Date: Wed, 5 Nov 2008 11:47:04 +0000 Subject: [PATCH] Minor change --- src/SalomeApp/SalomeApp_DoubleSpinBox.cxx | 7 +++++++ src/SalomeApp/SalomeApp_DoubleSpinBox.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx b/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx index 8ff2b5e03..25a5a87d3 100644 --- a/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx +++ b/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx @@ -44,6 +44,7 @@ SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox( QWidget* parent ) : QtxDoubleSpinBox( parent ), myDefaultValue( 0.0 ), + myIsRangeSet( false ), myMinimum( 0.0 ), myMaximum( 99.99 ) { @@ -64,6 +65,7 @@ SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox( QWidget* parent ) SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox( double min, double max, double step, QWidget* parent ) : QtxDoubleSpinBox( min, max, step, parent ), myDefaultValue( 0.0 ), + myIsRangeSet( false ), myMinimum( min ), myMaximum( max ) { @@ -84,6 +86,7 @@ SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox( double min, double max, double SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox( double min, double max, double step, int prec, int dec, QWidget* parent ) : QtxDoubleSpinBox( min, max, step, prec, dec, parent ), myDefaultValue( 0.0 ), + myIsRangeSet( false ), myMinimum( min ), myMaximum( max ) { @@ -167,6 +170,7 @@ void SalomeApp_DoubleSpinBox::setRange( const double min, const double max ) { QtxDoubleSpinBox::setRange( min, max ); + myIsRangeSet = true; myMinimum = min; myMaximum = max; } @@ -198,6 +202,9 @@ double SalomeApp_DoubleSpinBox::defaultValue() const */ bool SalomeApp_DoubleSpinBox::checkRange( const QString& str ) const { + if( !myIsRangeSet ) + return true; + bool ok = false; double value = str.toDouble( &ok ); return ok && value >= myMinimum && value <= myMaximum; diff --git a/src/SalomeApp/SalomeApp_DoubleSpinBox.h b/src/SalomeApp/SalomeApp_DoubleSpinBox.h index 9f815ac3f..8aed2cf4b 100644 --- a/src/SalomeApp/SalomeApp_DoubleSpinBox.h +++ b/src/SalomeApp/SalomeApp_DoubleSpinBox.h @@ -54,9 +54,11 @@ protected: bool findVariable( const QString&, double& ) const; private: + double myDefaultValue; + + bool myIsRangeSet; double myMinimum; double myMaximum; - double myDefaultValue; }; #endif -- 2.39.2