-// 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
#include <ModuleBase_WidgetExprEditor.h>
#include <ModuleBase_Tools.h>
+#include <Locale_Convert.h>
+
#include <ModelAPI_Data.h>
#include <ModelAPI_Object.h>
#include <ModelAPI_Validator.h>
aMainLay->addWidget(myResultLabel);
myEditor = new ExpressionEditor(this);
myEditor->setMinimumHeight(20);
- myEditor->setPlaceHolderText( QString::fromStdString( thePlaceHolder ) );
+ myEditor->setPlaceHolderText( translate( thePlaceHolder ) );
aMainLay->addWidget(myEditor);
this->setLayout(aMainLay);
AttributeStringPtr aStringAttr = aData->string(attributeID());
QString aWidgetValue = myEditor->toPlainText();
- aStringAttr->setValue(aWidgetValue.toStdString());
+ aStringAttr->setValue(aWidgetValue.toStdWString());
updateObject(myFeature);
// Try to get the value
bool isBlocked = myEditor->blockSignals(true);
QTextCursor aCursor = myEditor->textCursor();
int pos = aCursor.position();
- std::string aRestoredStr = aStringAttr->value();
- myEditor->setPlainText(QString::fromStdString(aRestoredStr));
+ QString aRestoredStr;
+ if (aStringAttr->isUValue())
+ aRestoredStr = QString::fromStdWString(Locale::Convert::toWString(aStringAttr->valueU()));
+ else
+ aRestoredStr = QString::fromStdString(aStringAttr->value());
+ myEditor->setPlainText(aRestoredStr);
aCursor.setPosition(pos);
myEditor->setTextCursor(aCursor);
myEditor->blockSignals(isBlocked);