From 293e8eed503d335fa9c0dd9d4fba65c223096d10 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 31 Aug 2015 12:23:54 +0300 Subject: [PATCH] Update root index on changing of number of children --- src/XGUI/XGUI_DataModel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); } } } -- 2.39.2