Salome HOME
Abort Sketch by click on the button in the tool bar. Abort nested opened operations.
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetDoubleValue.cpp
index a17ea26c9793ee4a8c3acab86dc7f5df40b0646b..9e222e9869d3d007ef441173dc7b041830977705 100644 (file)
@@ -96,12 +96,11 @@ ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue()
 
 void ModuleBase_WidgetDoubleValue::reset()
 {
-  if (isComputedDefault()) {
+  if (isComputedDefault() || mySpinBox->hasVariable()) {
     return;
     //if (myFeature->compute(myAttributeID))
     //  restoreValue();
-  }
-  else {
+  } else {
     bool isOk;
     double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk);
     // reset the value just if there is a default value definition in the XML definition
@@ -121,6 +120,8 @@ bool ModuleBase_WidgetDoubleValue::storeValueCustom() const
   std::string aTextRepr = aReal->text();
   if (mySpinBox->hasVariable()) {
     aTextRepr = mySpinBox->text().toStdString();
+  } else {
+    aTextRepr = "";
   }
   aReal->setText(aTextRepr);
   updateObject(myFeature);
@@ -133,7 +134,9 @@ bool ModuleBase_WidgetDoubleValue::restoreValue()
   AttributeDoublePtr aRef = aData->real(attributeID());
   std::string aTextRepr = aRef->text();
   if (!aTextRepr.empty()) {
+    bool isBlocked = mySpinBox->blockSignals(true);
     mySpinBox->setText(QString::fromStdString(aTextRepr));
+    mySpinBox->blockSignals(isBlocked);
   } else {
     ModuleBase_Tools::setSpinValue(mySpinBox, aRef->value());
   }