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
DataPtr aData = myFeature->data();
AttributeDoublePtr aReal = aData->real(attributeID());
aReal->setValue(mySpinBox->value());
- std::string aTextRepr;
+ 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());
}