Commit 4ec54ee3 authored by Anatoly Mihalchenko's avatar Anatoly Mihalchenko

Delete group after deletion of last member

parent 4b6bb08b
...@@ -1600,6 +1600,8 @@ void UBGraphicsScene::addItems(const QSet<QGraphicsItem*>& items) ...@@ -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) ...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment