Salome HOME
Support of wide string
[modules/shaper.git] / src / XGUI / XGUI_ObjectsBrowser.cpp
index a83a67251145cd80563734a6f633f691d16ae2d6..738b11aeebf15711a38975039858a499152ab753 100644 (file)
@@ -31,6 +31,7 @@
 #include <ModuleBase_ITreeNode.h>
 
 #include <XGUI_Workshop.h>
+#include <XGUI_Displayer.h>
 
 #include <QLayout>
 #include <QLineEdit>
@@ -72,7 +73,7 @@ public:
       XGUI_DataModel* aModel = myTreedView->dataModel();
       ObjectPtr aObj = aModel->object(index);
       if (aObj.get() != NULL) {
-        aEditor->setText(aObj->data()->name().c_str());
+        aEditor->setText(QString::fromStdWString(aObj->data()->name()));
         return;
       }
     }
@@ -130,7 +131,8 @@ void XGUI_DataTree::commitData(QWidget* theEditor)
       if (XGUI_Tools::canRename(aObj, aName)) {
         SessionPtr aMgr = ModelAPI_Session::get();
         aMgr->startOperation("Rename");
-        aObj->data()->setName(qPrintable(aName));
+        std::wstring aaa = aName.toStdWString();
+        aObj->data()->setName(aName.toStdWString());
         aMgr->finishOperation();
       }
     }
@@ -227,6 +229,8 @@ void XGUI_DataTree::processHistoryChange(const QModelIndex& theIndex)
     update(aModel->index(i, 1, aParent));
     update(aModel->index(i, 2, aParent));
   }
+  XGUI_ObjectsBrowser* aObjBrowser = qobject_cast<XGUI_ObjectsBrowser*>(parent());
+  aObjBrowser->workshop()->displayer()->updateViewer();
 }
 
 void XGUI_DataTree::processEyeClick(const QModelIndex& theIndex)
@@ -251,11 +255,11 @@ void XGUI_DataTree::processEyeClick(const QModelIndex& theIndex)
 
     // Update list of selected objects because this event happens after
     // selection event in object browser
+    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+    update(theIndex);
     if (aObjBrowser) {
       aObjBrowser->onSelectionChanged();
     }
-    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
-    update(theIndex);
   }
 }