diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 0f3ecc17..d5eb8d36 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1099,6 +1099,11 @@ void UBGraphicsScene::clearItemsAndAnnotations() setDocumentUpdated(); } +bool isService(QGraphicsItem *item) { + return (item->type() == UBGraphicsDelegateFrame::Type) + || (item->parentItem() && item->parentItem()->Type == UBGraphicsDelegateFrame::Type); +} + void UBGraphicsScene::clearItems() { deselectAllItems(); @@ -1113,9 +1118,13 @@ void UBGraphicsScene::clearItems() bool isPolygon = qgraphicsitem_cast(item) != NULL; bool isStrokesGroup = qgraphicsitem_cast(item) != NULL; - if(!isGroup && !isPolygon && !isStrokesGroup && !mTools.contains(item) && !isBackgroundObject(item)) - { + bool inGroup = (item->parentItem() + && (item->parentItem()->type() == UBGraphicsGroupContainerItem::Type)); + + if(!isGroup && !isPolygon && !isStrokesGroup && !mTools.contains(item) && !isBackgroundObject(item)) { removeItem(item); + } + if (!inGroup || !isService(item)) { removedItems << item; } } @@ -1611,14 +1620,14 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item) mFastAccessItems.removeAll(item); - if (group) - { - if (group->childItems().empty()) - { - group->Delegate()->remove(); - UBCoreGraphicsScene::removeItemFromDeletion(group); - } - } +// if (group) +// { +// if (group->childItems().empty()) +// { +// group->Delegate()->remove(); +// UBCoreGraphicsScene::removeItemFromDeletion(group); +// } +// } } void UBGraphicsScene::removeItems(const QSet& items) diff --git a/src/frameworks/UBCoreGraphicsScene.cpp b/src/frameworks/UBCoreGraphicsScene.cpp index b39eef0d..28dd6a9f 100644 --- a/src/frameworks/UBCoreGraphicsScene.cpp +++ b/src/frameworks/UBCoreGraphicsScene.cpp @@ -73,6 +73,7 @@ void UBCoreGraphicsScene::removeItem(QGraphicsItem* item, bool forceDelete) QGraphicsScene::removeItem(item); if (forceDelete) { + qDebug() << "force delete is " << forceDelete; deleteItem(item); } setModified(true);