From: vsv Date: Mon, 31 Aug 2015 09:23:54 +0000 (+0300) Subject: Update root index on changing of number of children X-Git-Tag: V_1.4.0_beta4~190 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=293e8eed503d335fa9c0dd9d4fba65c223096d10;p=modules%2Fshaper.git Update root index on changing of number of children --- diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 4a54e941b..7d1a27cd5 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -120,7 +120,7 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess // Appears first object in folder which can not be shown empty insertRow(myXMLReader.subFolderId(aObjType), aDocRoot); } - int aRow = aDoc->size(aObjType) - 1; + int aRow = aDoc->index(aObject); int aNbSubFolders = foldersCount(aDoc.get()); if (aObjType == aSubType) { // List of objects under document root @@ -130,7 +130,9 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess if (aRow != -1) { int aFolderId = folderId(aObjType, aDoc.get()); if (aFolderId != -1) { - insertRow(aRow, createIndex(aFolderId, 0, aDoc.get())); + QModelIndex aParentFolder = createIndex(aFolderId, 0, aDoc.get()); + insertRow(aRow, aParentFolder); + emit dataChanged(aParentFolder, aParentFolder); } } }