From f5bf0c46be44b5c8625fa60ce45a607c407a82c2 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 28 Aug 2018 16:58:33 +0300 Subject: [PATCH] Fix for removing of all sub-objects --- src/XGUI/XGUI_DataModel.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 31cb8d382..b31e32f36 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -132,7 +132,10 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess insertRows(aOldNb - 1, aNewNb - aOldNb, aFirstIdx); } else if (aNewNb < aOldNb) { - removeRows(aNewNb - 1, aOldNb - aNewNb, aFirstIdx); + if (aNewNb) + removeRows(aNewNb - 1, aOldNb - aNewNb, aFirstIdx); + else if (aOldNb) + removeRows(0, aOldNb, aFirstIdx); } dataChanged(aFirstIdx, aLastIdx); } @@ -187,7 +190,10 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess insertRows(aOldNb - 1, aNewNb - aOldNb, aFirstIdx); } else if (aNewNb < aOldNb) { - removeRows(aNewNb - 1, aOldNb - aNewNb, aFirstIdx); + if (aNewNb) + removeRows(aNewNb - 1, aOldNb - aNewNb, aFirstIdx); + else if (aOldNb) + removeRows(0, aOldNb, aFirstIdx); } dataChanged(aFirstIdx, aLastIdx); } -- 2.39.2