-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// Nullyfy the parameter reference without deletion of the created
myParameter = FeaturePtr();
}
- aReal->setText(aText.toStdString());
+ aReal->setText(aText.toStdWString());
} 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
aReal->setExpressionError("");
aReal->setExpressionInvalid(false);
}
- aReal->setText("");
+ aReal->setText(L"");
aReal->setValue(mySpinBox->value());
}
updateObject(myFeature);
{
DataPtr aData = myFeature->data();
AttributeDoublePtr aRef = aData->real(attributeID());
- std::string aTextRepr = aRef->text();
+ std::wstring aTextRepr = aRef->text();
if (!aTextRepr.empty()) {
- QString aText = QString::fromStdString(aTextRepr);
- //if (aText.endsWith('=')) {
- // if (!myParameter.get()) {
- // QString aName = aText.left(aText.indexOf('=')).trimmed();
- // myParameter = ModuleBase_Tools::findParameter(aName);
- // }
- // /// If myParameter is empty then it was not created because of an error
- // if (!myParameter.get())
- // return false;
-
- // AttributeStringPtr aExprAttr = myParameter->string("expression");
- // aText += aExprAttr->value().c_str();
- //}
+ QString aText = QString::fromStdWString(aTextRepr);
ModuleBase_Tools::setSpinText(mySpinBox, aText);
}
else {
}
return isModified;
}
+
+bool ModuleBase_WidgetDoubleValue::isModified() const
+{
+ QString aText = mySpinBox->text();
+ if (aText.isEmpty())
+ return false;
+
+ if (myHasDefault) {
+ bool aOk = false;
+ double aVal = aText.toDouble(&aOk);
+ if (!aOk || aVal == myDefaultVal)
+ return false;
+ }
+ return true;
+}
\ No newline at end of file