Salome HOME
Define Rename as an operation
[modules/shaper.git] / src / ModuleBase / ModuleBase_DoubleSpinBox.cpp
index 59d5c0285e40256c87a28c9d02b4d81479e88997..080138f5483b0314722ba314cb4c0ed73a4b7a93 100644 (file)
@@ -60,7 +60,7 @@ ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* theParent, int thePr
       myCleared(false)
 {
   // VSR 01/07/2010: Disable thousands separator for spin box
-  // (to avoid incosistency of double-2-string and string-2-double conversion)
+  // (to avoid inconsistency of double-2-string and string-2-double conversion)
   QLocale loc;
   loc.setNumberOptions(loc.numberOptions() | QLocale::OmitGroupSeparator | QLocale::RejectGroupSeparator);
   setLocale(loc);
@@ -71,7 +71,7 @@ ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* theParent, int thePr
   // Use precision equal to default Qt decimals
   // it's necessary to set decimals before the range setting,
   // by default Qt rounds boundaries to 2 decimals at setRange
-  setDecimals(thePrecision);
+  setDecimals(qAbs(myPrecision));
 
   connect(lineEdit(), SIGNAL(textChanged( const QString& )), this,
           SLOT(onTextChanged( const QString& )));
@@ -119,8 +119,8 @@ void ModuleBase_DoubleSpinBox::setCleared(const bool on)
  */
 void ModuleBase_DoubleSpinBox::setPrecision(const int prec)
 {
-  int newPrec = qMax(prec, 0);
-  int oldPrec = qMax(myPrecision, 0);
+  int newPrec = qAbs(prec);
+  int oldPrec = qAbs(myPrecision);
   myPrecision = prec;
   if (newPrec != oldPrec)
     update();
@@ -128,7 +128,7 @@ void ModuleBase_DoubleSpinBox::setPrecision(const int prec)
 
 /*!
  \brief Get precision value of the spin box
- \return current prevision value
+ \return current precision value
  \sa setPrecision()
  */
 int ModuleBase_DoubleSpinBox::getPrecision() const
@@ -271,7 +271,7 @@ QValidator::State ModuleBase_DoubleSpinBox::validate(QString& str, int& pos) con
     }
   }
 
-  // Treat values ouside (min; max) range as Invalid
+  // Treat values outside (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) {