X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetIntValue.cpp;h=cb2e503f0f3c513921e0e0149143bed765e13488;hb=ced2b33b41ece5969c897328e7a914b572be40e7;hp=0e131bb1dc8dda8766947714177e795ea9a01e38;hpb=c4eab94a20a0d93100549a210582d46409fec1cc;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp index 0e131bb1d..cb2e503f0 100644 --- a/src/ModuleBase/ModuleBase_WidgetIntValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetIntValue.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 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 @@ -160,7 +160,7 @@ bool ModuleBase_WidgetIntValue::storeValueCustom() // 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 @@ -169,7 +169,7 @@ bool ModuleBase_WidgetIntValue::storeValueCustom() anAttribute->setExpressionError(""); anAttribute->setExpressionInvalid(false); } - anAttribute->setText(""); + anAttribute->setText(L""); anAttribute->setValue(mySpinBox->value()); } updateObject(myFeature); @@ -180,9 +180,9 @@ bool ModuleBase_WidgetIntValue::restoreValueCustom() { 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(); @@ -230,3 +230,18 @@ bool ModuleBase_WidgetIntValue::processEnter() } 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