From 17cb9c45dca6f3e311a874c93b9e92e7f9930ca4 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 23 May 2014 13:31:29 +0400 Subject: [PATCH] Delete feature operation bugs fixing --- src/XGUI/XGUI_DocumentDataModel.cpp | 2 +- src/XGUI/XGUI_Workshop.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp index d1ca2c2ed..9cbe795c7 100644 --- a/src/XGUI/XGUI_DocumentDataModel.cpp +++ b/src/XGUI/XGUI_DocumentDataModel.cpp @@ -117,7 +117,7 @@ void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage) } if (aPartModel) { QModelIndex aIndex = aPartModel->findGroup(aGroup); - int aStart = aPartModel->rowCount(aIndex); + int aStart = aPartModel->rowCount(aIndex) - 1; aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex)); removeRow(aStart, aIndex); } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 3d81ef0a1..44a2c7b3c 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -814,12 +814,17 @@ void XGUI_Workshop::deleteFeatures(QFeatureList theList) } else { ObjectPtr aObject = boost::dynamic_pointer_cast(aFeature); aDoc = aObject->featureRef()->data()->docRef("PartDocument")->value(); + aFeature = aObject->featureRef(); } if (aDoc == aMgr->currentDocument()) { aDoc->close(); } - } //else - //aDoc = aFeature->document(); + } else { + if (!aFeature->data()) { + ObjectPtr aObject = boost::dynamic_pointer_cast(aFeature); + aFeature = aObject->featureRef(); + } + } aMgr->rootDocument()->removeFeature(aFeature); } aMgr->rootDocument()->finishOperation(); -- 2.39.2