From 1631e78ccd2924167444bca66d478d39552b210f Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 25 Jul 2018 17:49:17 +0300 Subject: [PATCH] Issue #2571: Clear error flag if the control is initialized from the attribute --- src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index 0adf8f355..2b8325115 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -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; } -- 2.39.2