From: vsv Date: Mon, 29 Oct 2018 12:24:07 +0000 (+0300) Subject: Issue #2726: Update a tree branch on creation of a Folder X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=325b30cfdf0ad6e23193aab724b88654b5fea356;p=modules%2Fshaper.git Issue #2726: Update a tree branch on creation of a Folder --- diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index ee7f93457..f2cfa898a 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -73,13 +73,21 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& 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)) {