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();
+ }
}
}
std::string aTextRepr = aReal->text();
if (mySpinBox->hasVariable()) {
aTextRepr = mySpinBox->text().toStdString();
+ } else {
+ aTextRepr = "";
}
aReal->setText(aTextRepr);
updateObject(myFeature);
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());
}