]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Issue 0020580: disable strict min/max checking of manually entered text by default... V5_1_4a1
authorsan <san@opencascade.com>
Thu, 15 Apr 2010 13:45:42 +0000 (13:45 +0000)
committersan <san@opencascade.com>
Thu, 15 Apr 2010 13:45:42 +0000 (13:45 +0000)
src/Qtx/QtxDoubleSpinBox.cxx

index 579509e92addc6ae979636ef8618d7e502d465a2..15fbf1355f3c8cf7a5b4598b5927a984281c55b7 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <QLineEdit>
 #include <QDoubleValidator>
+#include <QVariant>
 
 #include <limits>
 
@@ -320,12 +321,17 @@ QValidator::State QtxDoubleSpinBox::validate( QString& str, int& pos ) const
     }
 
   // Treat values ouside (min; max) range as Invalid
+  // This check is enabled by assigning "strict_validity_check" dynamic property
+  // with value "true" to the spin box instance.
   if ( state == QValidator::Intermediate ){
     bool isOk;
     double val = str.toDouble( &isOk );
     if ( isOk ){
-      if ( val < minimum() || val > maximum() )
-        state = QValidator::Invalid;
+      QVariant propVal = property( "strict_validity_check" );
+      if ( propVal.isValid() && propVal.canConvert( QVariant::Bool ) && propVal.toBool() ){
+        if ( val < minimum() || val > maximum() )
+          state = QValidator::Invalid;
+      }
     }
     else if ( myPrecision < 0 ){
       // Consider too large negative exponent as Invalid