From 4ec54ee3a86ceefcdec2b87b8c4a6d212cea76fe Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Mon, 3 Sep 2012 20:31:51 +0300 Subject: [PATCH] Delete group after deletion of last member --- src/domain/UBGraphicsScene.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 018d463c..0f3ecc17 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1600,6 +1600,8 @@ void UBGraphicsScene::addItems(const QSet& items) void UBGraphicsScene::removeItem(QGraphicsItem* item) { + UBGraphicsGroupContainerItem* group = qgraphicsitem_cast(item->parentItem()); + item->setSelected(false); UBCoreGraphicsScene::removeItem(item); UBApplication::boardController->freezeW3CWidget(item, true); @@ -1608,6 +1610,15 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item) --mItemCount; mFastAccessItems.removeAll(item); + + if (group) + { + if (group->childItems().empty()) + { + group->Delegate()->remove(); + UBCoreGraphicsScene::removeItemFromDeletion(group); + } + } } void UBGraphicsScene::removeItems(const QSet& items)