-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <ModuleBase_WidgetIntValue.h>
// Nullyfy the parameter reference without deletion of the created
myParameter = FeaturePtr();
}
- anAttribute->setText(aText.toStdString());
+ anAttribute->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
anAttribute->setExpressionError("");
anAttribute->setExpressionInvalid(false);
}
- anAttribute->setText("");
+ anAttribute->setText(L"");
anAttribute->setValue(mySpinBox->value());
}
updateObject(myFeature);
{
DataPtr aData = myFeature->data();
AttributeIntegerPtr anAttribute = aData->integer(attributeID());
- std::string aTextRepr = anAttribute->text();
+ std::wstring aTextRepr = anAttribute->text();
if (!aTextRepr.empty()) {
- QString aText = QString::fromStdString(aTextRepr);
+ QString aText = QString::fromStdWString(aTextRepr);
//if (aText.endsWith('=')) {
// if (!myParameter.get()) {
// QString aName = aText.left(aText.indexOf('=')).trimmed();
}
return isModified;
}
+
+bool ModuleBase_WidgetIntValue::isModified() const
+{
+ QString aText = mySpinBox->text();
+ if (aText.isEmpty())
+ return false;
+
+ if (myHasDefault) {
+ bool aOk = false;
+ int aVal = aText.toInt(&aOk);
+ if (!aOk || aVal == myDefVal)
+ return false;
+ }
+ return true;
+}
\ No newline at end of file