]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2726: Update a tree branch on creation of a Folder
authorvsv <vsv@opencascade.com>
Mon, 29 Oct 2018 12:24:07 +0000 (15:24 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Nov 2018 08:45:52 +0000 (11:45 +0300)
src/XGUI/XGUI_DataModel.cpp

index ee7f934575be45e96d283c0059cd48470785725e..f2cfa898a12481d8394f1b28ab0803ebe67475e7 100644 (file)
@@ -73,13 +73,21 @@ void XGUI_DataModel::processEvent(const std::shared_ptr<Events_Message>& theMess
     ModuleBase_ITreeNode* aParent;
     int aRow = 0;
     QModelIndex aParentIndex1, aParentIndex2;
+    ObjectPtr aObj;
     foreach(ModuleBase_ITreeNode* aNode, aNodes) {
+      aObj = aNode->object();
       aParent = aNode->parent();
-      aRow = aParent->nodeRow(aNode);
-      aParentIndex1 = getParentIndex(aNode, 0);
-      aParentIndex2 = getParentIndex(aNode, 2);
-      insertRows(aRow, 1, aParentIndex1);
-      dataChanged(aParentIndex1, aParentIndex2);
+      if (aObj.get() && (aObj->groupName() == ModelAPI_Folder::group())) {
+        aParent->update();
+        rebuildDataTree();
+      }
+      else {
+        aRow = aParent->nodeRow(aNode);
+        aParentIndex1 = getParentIndex(aNode, 0);
+        aParentIndex2 = getParentIndex(aNode, 2);
+        insertRows(aRow, 1, aParentIndex1);
+        dataChanged(aParentIndex1, aParentIndex2);
+      }
     }
   }
   else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {