ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
const Config_WidgetAPI* theData)
- : ModuleBase_ModelWidget(theParent, theData)
+ : ModuleBase_ModelWidget(theParent, theData), myHasDefault(false)
{
QFormLayout* aControlLay = new QFormLayout(this);
ModuleBase_Tools::adjustMargins(aControlLay);
mySpinBox->setSingleStep(aStepVal);
}
- myDefaultVal = QString::fromStdString(getDefaultValue()).toDouble(&isOk);
- if (isOk)
+ myDefaultVal = QString::fromStdString(getDefaultValue()).toDouble(&myHasDefault);
+ if (myHasDefault)
mySpinBox->setValue(myDefaultVal);
- else
- myDefaultVal = 0;
QString aTTip = translate(theData->widgetTooltip());
mySpinBox->setToolTip(aTTip);
aRef->setExpressionError("");
aRef->setExpressionInvalid(false);
}
- if (!aRef->isInitialized())
+ if ((!aRef->isInitialized()) && myHasDefault)
aRef->setValue(myDefaultVal);
}
return true;