]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_WidgetExprEditor.cpp
Salome HOME
Issue #3237: Allow usage of accented characters in ObjectBrowser
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetExprEditor.cpp
index e70a75f1574d0ec9f0e5fce3c7fbd968a9f861be..3050e10e8228df8ecd195abdbce979bd4cf56bce 100644 (file)
@@ -20,6 +20,8 @@
 #include <ModuleBase_WidgetExprEditor.h>
 #include <ModuleBase_Tools.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Validator.h>
@@ -268,7 +270,7 @@ bool ModuleBase_WidgetExprEditor::storeValueCustom()
   AttributeStringPtr aStringAttr = aData->string(attributeID());
 
   QString aWidgetValue = myEditor->toPlainText();
-  aStringAttr->setValue(aWidgetValue.toStdString());
+  aStringAttr->setValue(aWidgetValue.toStdWString());
   updateObject(myFeature);
 
   // Try to get the value
@@ -303,8 +305,12 @@ bool ModuleBase_WidgetExprEditor::restoreValueCustom()
   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);