X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetDoubleValue.cpp;h=9e222e9869d3d007ef441173dc7b041830977705;hb=872ac5e3e0196ad70c2a01a79bd070c9a7d4a2e6;hp=d3d777e33fe59467ebf04f8aaeee260bbe664c71;hpb=73275e14806a085d0bb397b8f9f6f4f90e2bb4c8;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index d3d777e33..9e222e986 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -96,16 +96,19 @@ 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); - ModuleBase_Tools::setSpinValue(mySpinBox, isOk ? aDefValue : 0.0); - storeValueCustom(); + // reset the value just if there is a default value definition in the XML definition + // if the double value can not be found by the default value, do nothing + if (isOk) { + ModuleBase_Tools::setSpinValue(mySpinBox, isOk ? aDefValue : 0.0); + storeValueCustom(); + } } } @@ -117,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); @@ -129,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()); }