From 50731891a72a762111e7a65f7de233ebe03655ad Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 26 May 2015 15:18:16 +0300 Subject: [PATCH] Remove index of history item in part data tree --- src/PartSet/PartSet_DocumentDataModel.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/PartSet/PartSet_DocumentDataModel.cpp b/src/PartSet/PartSet_DocumentDataModel.cpp index 961768c18..8d2eea905 100644 --- a/src/PartSet/PartSet_DocumentDataModel.cpp +++ b/src/PartSet/PartSet_DocumentDataModel.cpp @@ -155,9 +155,15 @@ void PartSet_DocumentDataModel::processEvent(const std::shared_ptrfindGroup(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); + } } } } -- 2.39.2