+ AttributeIntegerPtr anAttribute = aData->integer(attributeID());
+ if (mySpinBox->hasVariable()) {
+ // Here is a text of a real value or an expression.
+ QString aText = mySpinBox->text();
+ if (aText.contains('=')) {
+ if (!myParameter.get()) {
+ myParameter = ModuleBase_Tools::createParameter(aText);
+ if (!myParameter.get()) {
+ anAttribute->setExpressionError("Parameter cannot be created");
+ anAttribute->setExpressionInvalid(true);
+ updateObject(myFeature);
+ return false;
+ } else if (anAttribute->expressionInvalid()) {
+ anAttribute->setExpressionError("");
+ anAttribute->setExpressionInvalid(false);
+ }
+ } else {
+ ModuleBase_Tools::editParameter(myParameter, aText);
+ }
+ aText = aText.split('=').at(0);
+ } else if (myParameter.get()) {
+ // Nullyfy the parameter reference without deletion of the created
+ myParameter = FeaturePtr();
+ }
+ anAttribute->setText(aText.toStdString());
+ } else {
+ // it is important to set the empty text value to the attribute before set the value
+ // because setValue tries to calculate the attribute value according to the
+ // attribute current text
+ if (anAttribute->expressionInvalid()) {
+ anAttribute->setExpressionError("");
+ anAttribute->setExpressionInvalid(false);
+ }
+ anAttribute->setText("");
+ anAttribute->setValue(mySpinBox->value());
+ }