Salome HOME
Issue #2324: Update object browser after hide all on Linux
authorvsv <vsv@opencascade.com>
Wed, 6 Dec 2017 14:40:06 +0000 (17:40 +0300)
committervsv <vsv@opencascade.com>
Wed, 6 Dec 2017 14:40:06 +0000 (17:40 +0300)
src/XGUI/XGUI_ObjectsBrowser.cpp

index 76a63127ad85eb93f23419198fe1f3e773943b2e..983f4c37ea1d035a2624fd5e982d4a9ca27883a2 100644 (file)
@@ -624,11 +624,12 @@ void XGUI_ObjectsBrowser::setStateForDoc(DocumentPtr theDoc, const std::list<boo
 
 void XGUI_ObjectsBrowser::updateAllIndexes(int theColumn, const QModelIndex& theParent)
 {
-  const QAbstractItemModel* aModel = theParent.model();
-  int aNb = aModel->rowCount();
+  int aNb = myDocModel->rowCount(theParent);
   for (int i = 0; i < aNb; i++) {
-    QModelIndex aIdx = theParent.child(i, theColumn);
-    myTreeView->update(aIdx);
-    updateAllIndexes(theColumn, aIdx);
+    QModelIndex aIdx = myDocModel->index(i, theColumn, theParent);
+    if (aIdx.isValid()) {
+      myTreeView->update(aIdx);
+      updateAllIndexes(theColumn, aIdx);
+    }
   }
 }