From 1209486df2d9718de7d4fa392fa17eeae789be4f Mon Sep 17 00:00:00 2001 From: ouv Date: Wed, 9 Dec 2009 09:53:13 +0000 Subject: [PATCH] Debug --- src/SalomeApp/SalomeApp_DoubleSpinBox.cxx | 18 +++++++-------- src/SalomeApp/SalomeApp_IntSpinBox.cxx | 27 +++++++++++------------ 2 files changed, 22 insertions(+), 23 deletions(-) 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; -- 2.39.2