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-Tag: End2018~242 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9549a264ff1d052e4a37499efd89a4069404260a;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)) {