Delete group after deletion of last member

preferencesAboutTextFull
Anatoly Mihalchenko 12 years ago
parent 4b6bb08b9b
commit 4ec54ee3a8
  1. 11
      src/domain/UBGraphicsScene.cpp

@ -1600,6 +1600,8 @@ void UBGraphicsScene::addItems(const QSet<QGraphicsItem*>& items)
void UBGraphicsScene::removeItem(QGraphicsItem* item) void UBGraphicsScene::removeItem(QGraphicsItem* item)
{ {
UBGraphicsGroupContainerItem* group = qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(item->parentItem());
item->setSelected(false); item->setSelected(false);
UBCoreGraphicsScene::removeItem(item); UBCoreGraphicsScene::removeItem(item);
UBApplication::boardController->freezeW3CWidget(item, true); UBApplication::boardController->freezeW3CWidget(item, true);
@ -1608,6 +1610,15 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
--mItemCount; --mItemCount;
mFastAccessItems.removeAll(item); mFastAccessItems.removeAll(item);
if (group)
{
if (group->childItems().empty())
{
group->Delegate()->remove();
UBCoreGraphicsScene::removeItemFromDeletion(group);
}
}
} }
void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items) void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items)

Loading…
Cancel
Save