]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Remove index of history item in part data tree
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 26 May 2015 12:18:16 +0000 (15:18 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 26 May 2015 12:18:16 +0000 (15:18 +0300)
src/PartSet/PartSet_DocumentDataModel.cpp

index 961768c1892a89c3e62f76ca19029452af416231..8d2eea90576ac2f7f627770f35f758be6cc285fc 100644 (file)
@@ -155,9 +155,15 @@ void PartSet_DocumentDataModel::processEvent(const std::shared_ptr<Events_Messag
         }
         if (aPartModel) {
           QModelIndex aIndex = aPartModel->findGroup(aGroup);
-          int aStart = aPartModel->rowCount(aIndex);
-          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
-          removeRow(aStart, aIndex);
+          if (aIndex.isValid()) {
+            int aStart = aPartModel->rowCount(aIndex);
+            aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
+            removeRow(aStart, aIndex);
+          } else {
+            int aRow = aPartModel->rowCount();
+            aIndex = createIndex(aPartModel->position() + historyOffset(), 0, HistoryNode);
+            removeRow(aRow, aIndex);
+          }
         }
       }
     }