X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetDoubleValue.cpp;h=230f49220cbbd82e49947eb811b51776e80cd77f;hb=1804fe9b51c902003511022872a64ef4bc7775fc;hp=6aa383688e69272c252472f1fcbfb9075fb0a418;hpb=e2c1d6fb594fe1234fa7a0786801d8c1c92d7ac6;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index 6aa383688..230f49220 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -24,7 +23,6 @@ #include #include -#include #ifndef DBL_MAX #define DBL_MAX 1.7976931348623158e+308 @@ -94,12 +92,11 @@ ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() { } -void ModuleBase_WidgetDoubleValue::reset() +bool ModuleBase_WidgetDoubleValue::reset() { - if (isComputedDefault() || mySpinBox->hasVariable()) { - return; - //if (myFeature->compute(myAttributeID)) - // restoreValue(); + bool aDone = false; + if (!isUseReset() || isComputedDefault() || mySpinBox->hasVariable()) { + aDone = false; } else { bool isOk; double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk); @@ -108,8 +105,10 @@ void ModuleBase_WidgetDoubleValue::reset() if (isOk) { ModuleBase_Tools::setSpinValue(mySpinBox, aDefValue); storeValueCustom(); + aDone = true; } } + return aDone; } bool ModuleBase_WidgetDoubleValue::storeValueCustom() const @@ -118,16 +117,11 @@ bool ModuleBase_WidgetDoubleValue::storeValueCustom() const AttributeDoublePtr aReal = aData->real(attributeID()); if (!mySpinBox->hasVariable()) { aReal->setValue(mySpinBox->value()); + aReal->setText(""); } else { // Here is a text of a real value or an expression. std::string aText = mySpinBox->text().toStdString(); aReal->setText(aText); - // Send it to evaluator to convert into the double and store in the attribute - static Events_ID anId = ModelAPI_AttributeEvalMessage::eventId(); - std::shared_ptr aMessage = - std::shared_ptr(new ModelAPI_AttributeEvalMessage(anId, this)); - aMessage->setAttribute(aData->attribute(attributeID())); - Events_Loop::loop()->send(aMessage); } updateObject(myFeature); return true;