]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_ParamSpinBox.cpp
Salome HOME
Issue #653 - Double and triple click edges -- Fix Debian dynamic_pointer_cast problem...
[modules/shaper.git] / src / ModuleBase / ModuleBase_ParamSpinBox.cpp
index 58cd37d6289065ecf8c2ad02e85a088857db5f68..8b09ac9fece6ec394cf21314cd0a580084d3e274 100644 (file)
@@ -53,7 +53,7 @@ ModuleBase_ParamSpinBox::~ModuleBase_ParamSpinBox()
  */
 void ModuleBase_ParamSpinBox::stepBy(int steps)
 {
-  if (hasVariable())
+  if ((!myTextValue.isEmpty()) && hasVariable())
     return;
 
   ModuleBase_DoubleSpinBox::stepBy(steps);
@@ -73,6 +73,7 @@ void ModuleBase_ParamSpinBox::connectSignalsAndSlots()
  */
 void ModuleBase_ParamSpinBox::onTextChanged(const QString& text)
 {
+  ModuleBase_DoubleSpinBox::onTextChanged(text);
   myTextValue = text;
 }
 
@@ -93,7 +94,7 @@ double ModuleBase_ParamSpinBox::valueFromText(const QString& theText) const
 
 QString ModuleBase_ParamSpinBox::textFromValue (double theValue) const
 {
-  if (hasVariable(myTextValue)){
+  if ((!myTextValue.isEmpty()) && hasVariable(myTextValue)){
     return myTextValue;
   }
   return ModuleBase_DoubleSpinBox::textFromValue(theValue);
@@ -124,9 +125,8 @@ QValidator::State ModuleBase_ParamSpinBox::validate(QString& str, int& pos) cons
  */
 void ModuleBase_ParamSpinBox::setValue(const double value)
 {
-  ModuleBase_DoubleSpinBox::setValue(value);
-
   myTextValue = ModuleBase_DoubleSpinBox::textFromValue(value);
+  ModuleBase_DoubleSpinBox::setValue(value);
 }
 
 /*!
@@ -243,7 +243,7 @@ bool ModuleBase_ParamSpinBox::findVariable(const QString& theName,
 void ModuleBase_ParamSpinBox::showEvent(QShowEvent* theEvent)
 {
   ModuleBase_DoubleSpinBox::showEvent(theEvent);
-  if (hasVariable(myTextValue)) {
+  if ((!myTextValue.isEmpty()) && hasVariable(myTextValue)) {
     setText(myTextValue);
   }
 }