From: vsv Date: Tue, 28 Aug 2018 13:58:33 +0000 (+0300) Subject: Fix for removing of all sub-objects X-Git-Tag: SHAPER_V9_1_0RC1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f5bf0c46be44b5c8625fa60ce45a607c407a82c2;p=modules%2Fshaper.git Fix for removing of all sub-objects --- 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); }