X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ObjectsBrowser.cpp;h=7eb50de3409ce79f2c8a48199da60345c0a26c93;hb=1cef78af4c4328ecf99a3ced86bda38e6e82e15c;hp=0d9750e0804022017534d738fe6bd1a19879ecfb;hpb=521436cf10b6861697ce8c4c093f36ed253d5549;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index 0d9750e08..7eb50de34 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -444,10 +444,33 @@ void XGUI_ObjectsBrowser::onEditItem() } } +//*************************************************** +QModelIndexList XGUI_ObjectsBrowser::expandedItems(const QModelIndex& theParent) const +{ + QModelIndexList aIndexes; + QModelIndex aIndex; + for (int i = 0; i < myDocModel->rowCount(); i++) { + aIndex = myDocModel->index(i, 0, theParent); + if (myDocModel->hasChildren(aIndex)) { + if (myTreeView->isExpanded(aIndex)) { + aIndexes.append(aIndex); + QModelIndexList aSubIndexes = expandedItems(aIndex); + if (!aSubIndexes.isEmpty()) + aIndexes.append(aSubIndexes); + } + } + } + return aIndexes; +} + //*************************************************** void XGUI_ObjectsBrowser::rebuildDataTree() { + QModelIndexList aIndexList = expandedItems(); myDocModel->rebuildDataTree(); + foreach(QModelIndex aIndex, aIndexList) { + myTreeView->setExpanded(aIndex, true); + } update(); }