Salome HOME
Issue #2571: Clear error flag if the control is initialized from the attribute
authorvsv <vsv@opencascade.com>
Wed, 25 Jul 2018 14:49:17 +0000 (17:49 +0300)
committervsv <vsv@opencascade.com>
Wed, 25 Jul 2018 14:49:17 +0000 (17:49 +0300)
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp

index 0adf8f355ecc0f0f46bb24be6edc282bd4a13c9c..2b832511509c45997884e5456c6efc67a715aac9 100644 (file)
@@ -179,6 +179,10 @@ bool ModuleBase_WidgetDoubleValue::storeValueCustom()
     // it is important to set the empty text value to the attribute before set the value
     // because setValue tries to calculate the attribute value according to the
     // attribute current text
+    if (aReal->expressionInvalid()) {
+      aReal->setExpressionError("");
+      aReal->setExpressionInvalid(false);
+    }
     aReal->setText("");
     aReal->setValue(mySpinBox->value());
   }
@@ -208,6 +212,10 @@ bool ModuleBase_WidgetDoubleValue::restoreValueCustom()
     ModuleBase_Tools::setSpinText(mySpinBox, aText);
   } else {
     ModuleBase_Tools::setSpinValue(mySpinBox, aRef->isInitialized() ? aRef->value() : 0);
+    if (aRef->isInitialized() && aRef->expressionInvalid()) {
+      aRef->setExpressionError("");
+      aRef->setExpressionInvalid(false);
+    }
   }
   return true;
 }