Salome HOME
Issue #910 - Impossible to set start point , end points for line manually
authorspo <sergey.pokhodenko@opencascade.com>
Thu, 10 Sep 2015 07:52:59 +0000 (10:52 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Thu, 10 Sep 2015 07:53:09 +0000 (10:53 +0300)
src/ModuleBase/ModuleBase_DoubleSpinBox.cpp
src/ModuleBase/ModuleBase_DoubleSpinBox.h
src/ModuleBase/ModuleBase_ParamSpinBox.h

index 59d5c0285e40256c87a28c9d02b4d81479e88997..e11fbd73242303b7df7c2769eb403116919bbc16 100644 (file)
@@ -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
index 2daa53b955a94ecf7f4052f326168c79136238ea..87cbe6e84e665075d2fe425b3cafbd8834b9a4af 100644 (file)
@@ -21,7 +21,7 @@ class MODULEBASE_EXPORT ModuleBase_DoubleSpinBox : public QDoubleSpinBox
 Q_OBJECT
 
  public:
-  explicit ModuleBase_DoubleSpinBox( QWidget* theParent = 0, int thePrecision = 12 );
+  explicit ModuleBase_DoubleSpinBox( QWidget* theParent = 0, int thePrecision = -12 );
   virtual ~ModuleBase_DoubleSpinBox();
 
   /// Returns true if the control is clear
index 89e99ff7c0ce5a2889afed0ed065edbd8647f85d..7d14e951136d1f4cc6065fd650adc5adba00ec82 100644 (file)
@@ -15,7 +15,7 @@ class MODULEBASE_EXPORT ModuleBase_ParamSpinBox : public ModuleBase_DoubleSpinBo
   enum State { Invalid = 0, NoVariable, Incompatible, Acceptable };
 
 public:
-  explicit ModuleBase_ParamSpinBox( QWidget* theParent = 0, int thePrecision = 12 );
+  explicit ModuleBase_ParamSpinBox( QWidget* theParent = 0, int thePrecision = -12 );
   virtual ~ModuleBase_ParamSpinBox();
 
   virtual void stepBy(int);