From: sbh Date: Thu, 16 Apr 2015 13:36:25 +0000 (+0300) Subject: Issue #451: restore variable in editor X-Git-Tag: V_1.1.0~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3c6d69dbcde7450292cdf3b7bde8df716d8f577e;p=modules%2Fshaper.git Issue #451: restore variable in editor --- diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index 57e21b80b..925b1cc94 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -256,5 +256,7 @@ void ModuleBase_ParamSpinBox::keyPressEvent(QKeyEvent* e) void ModuleBase_ParamSpinBox::showEvent(QShowEvent* theEvent) { ModuleBase_DoubleSpinBox::showEvent(theEvent); - //setText(myTextValue); + if (hasVariable(myTextValue)) { + setText(myTextValue); + } } diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index a17ea26c9..551f9e7c8 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -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);