Salome HOME
Merge branch 'cadbld'
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetLineEdit.cpp
index f5429cc3f24228d888ce7c8a5dd15178b2295f12..9e544bcab99984fab0d60d25af28332af4d225a3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2021  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
@@ -21,6 +21,8 @@
 #include <ModuleBase_Tools.h>
 #include <ModuleBase_IconFactory.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
@@ -124,7 +126,7 @@ bool ModuleBase_WidgetLineEdit::storeValueCustom()
   DataPtr aData = myFeature->data();
   AttributeStringPtr aStringAttr = aData->string(attributeID());
   QString aWidgetValue = myLineEdit->text();
-  aStringAttr->setValue(aWidgetValue.toStdString());
+  aStringAttr->setValue(aWidgetValue.toStdWString());
   updateObject(myFeature);
   return true;
 }
@@ -138,7 +140,12 @@ bool ModuleBase_WidgetLineEdit::restoreValueCustom()
   AttributeStringPtr aStringAttr = aData->string(attributeID());
 
   bool isBlocked = myLineEdit->blockSignals(true);
-  myLineEdit->setText(QString::fromStdString(aStringAttr->value()));
+  QString aText;
+  if (aStringAttr->isUValue())
+    aText = QString::fromStdWString(Locale::Convert::toWString(aStringAttr->valueU()));
+  else
+    aText = QString::fromStdString(aStringAttr->value());
+  myLineEdit->setText(aText);
   myLineEdit->blockSignals(isBlocked);
 
   return true;