From 1da30c3b28cc0fe8f1f8c9ee09a2e26fec0634c2 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 4 Sep 2015 19:35:28 +0300 Subject: [PATCH] Take into account folders which can not be shown empty when history updated --- src/XGUI/XGUI_DataModel.cpp | 3 ++- src/XGUI/XGUI_ObjectsBrowser.cpp | 9 ++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index bc407998b..76fc27da0 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -192,8 +192,9 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess } // Check that some folders could disappear QStringList aNotEmptyFolders = listOfShowNotEmptyFolders(false); + int aSize = aDoc->size(aGroup); foreach (QString aNotEmptyFolder, aNotEmptyFolders) { - if ((aNotEmptyFolder.toStdString() == aGroup) && (aDoc->size(aGroup) == 1)) + if ((aNotEmptyFolder.toStdString() == aGroup) && (aSize == 0)) // Appears first object in folder which can not be shown empty removeRow(myXMLReader.subFolderId(aGroup), aDocRoot); } diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index 9a28b3292..c43ca86fa 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -141,8 +141,6 @@ void XGUI_DataTree::onDoubleClick(const QModelIndex& theIndex) DocumentPtr aDoc = aMgr->activeDocument(); - QModelIndex aOldIndex = aModel->lastHistoryIndex(); - std::string aOpName = tr("History change").toStdString(); if (aObj.get()) { if (aObj->document() != aDoc) @@ -165,13 +163,10 @@ void XGUI_DataTree::onDoubleClick(const QModelIndex& theIndex) } QModelIndex aNewIndex = aModel->lastHistoryIndex(); QModelIndex aParent = theIndex.parent(); - int aStartRow = std::min(aOldIndex.row(), aNewIndex.row()); - int aEndRow = std::max(aOldIndex.row(), aNewIndex.row()); - for (int i = aStartRow; i <= aEndRow; i++) { + int aSize = aModel->rowCount(aParent); + for (int i = 0; i < aSize; i++) { update(aModel->index(i, 0, aParent)); } - update(aOldIndex); - update(aNewIndex); } //******************************************************************** -- 2.39.2