From: vsv Date: Wed, 6 Dec 2017 14:18:44 +0000 (+0300) Subject: Issue #2324: Update object browser after hide all on Linux X-Git-Tag: V_2.10.0RC~96 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ea99914042d4b56dc72c95516db1913ba14fe113;p=modules%2Fshaper.git Issue #2324: Update object browser after hide all on Linux --- diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index 3b09d6ab7..76a63127a 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -621,3 +621,14 @@ void XGUI_ObjectsBrowser::setStateForDoc(DocumentPtr theDoc, const std::listsetExpanded(aIdx, (*aIt)); } } + +void XGUI_ObjectsBrowser::updateAllIndexes(int theColumn, const QModelIndex& theParent) +{ + const QAbstractItemModel* aModel = theParent.model(); + int aNb = aModel->rowCount(); + for (int i = 0; i < aNb; i++) { + QModelIndex aIdx = theParent.child(i, theColumn); + myTreeView->update(aIdx); + updateAllIndexes(theColumn, aIdx); + } +} diff --git a/src/XGUI/XGUI_ObjectsBrowser.h b/src/XGUI/XGUI_ObjectsBrowser.h index fd522c61a..372d4bb76 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.h +++ b/src/XGUI/XGUI_ObjectsBrowser.h @@ -206,6 +206,10 @@ Q_OBJECT void onSelectionChanged(); + /// Updates all items of object browser + /// \param theColumn - column of items + /// \param theParent - a parent item (by default from root) + void updateAllIndexes(int theColumn = 0, const QModelIndex& theParent = QModelIndex()); public slots: //! Called on Edit command request diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index de866856d..91d8757f2 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1474,12 +1474,7 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) updateCommandStatus(); #ifndef WIN32 // Necessary for update icons in ObjectBrowser on Linux - QModelIndexList aIndexes = mySelector->selection()->selectedIndexes(); - foreach (QModelIndex aIdx, aIndexes) { - if (aIdx.column() == 0) { - myObjectBrowser->treeView()->update(aIdx); - } - } + myObjectBrowser->updateAllIndexes(); #endif } else if (theId == "SELECT_VERTEX_CMD") { setViewerSelectionMode(TopAbs_VERTEX);