From: ouv Date: Wed, 9 Dec 2009 09:53:13 +0000 (+0000) Subject: Debug X-Git-Tag: PHASE_17_Part1_V3~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1209486df2d9718de7d4fa392fa17eeae789be4f;p=modules%2Fgui.git Debug --- diff --git a/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx b/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx index df0a0a36b..1b001c6cc 100644 --- a/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx +++ b/src/SalomeApp/SalomeApp_DoubleSpinBox.cxx @@ -277,18 +277,18 @@ void SalomeApp_DoubleSpinBox::setText( const QString& value ) */ SalomeApp_DoubleSpinBox::State SalomeApp_DoubleSpinBox::isValid( const QString& text, double& value, QStringList& absent ) const { - SearchState aSearchState = findVariable( text, value, absent ); - if( aSearchState == NotFound ) + bool isNumber = false; + value = QLocale().toDouble( text, &isNumber ); + if( !isNumber ) { - bool ok = false; - value = QLocale().toDouble( text, &ok ); - if ( !ok ) + SearchState aSearchState = findVariable( text, value, absent ); + if( aSearchState == NotFound ) return NoVariable; + else if( aSearchState == IncorrectType ) + return Incompatible; + else if( aSearchState == IncorrectExpression ) + return Invalid; } - else if( aSearchState == IncorrectType ) - return Incompatible; - else if( aSearchState == IncorrectExpression ) - return Invalid; if( !checkRange( value ) ) return Invalid; diff --git a/src/SalomeApp/SalomeApp_IntSpinBox.cxx b/src/SalomeApp/SalomeApp_IntSpinBox.cxx index 914db5821..388063750 100644 --- a/src/SalomeApp/SalomeApp_IntSpinBox.cxx +++ b/src/SalomeApp/SalomeApp_IntSpinBox.cxx @@ -233,23 +233,22 @@ void SalomeApp_IntSpinBox::setText( const QString& value ) */ SalomeApp_IntSpinBox::State SalomeApp_IntSpinBox::isValid( const QString& text, int& value, QStringList& absent ) const { - SearchState aSearchState = findVariable( text, value, absent ); - if( aSearchState == NotFound ) + bool isNumber = false; + value = text.toInt( &isNumber ); + if( !isNumber ) { - bool ok = false; - value = text.toInt( &ok ); - if( !ok ) - { - text.toDouble( &ok ); - if( ok ) - return Invalid; + text.toDouble( &isNumber ); + if( isNumber ) + return Invalid; + + SearchState aSearchState = findVariable( text, value, absent ); + if( aSearchState == NotFound ) return NoVariable; - } + else if( aSearchState == IncorrectType ) + return Incompatible; + else if( aSearchState == IncorrectExpression ) + return Invalid; } - else if( aSearchState == IncorrectType ) - return Incompatible; - else if( aSearchState == IncorrectExpression ) - return Invalid; if( !checkRange( value ) ) return Invalid;