diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index a836e3bc..62dcd073 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1632,11 +1632,11 @@ void UBBoardController::moveSceneToIndex(int source, int target) } } -void UBBoardController::findUniquesItems(const QUndoCommand *parent, QSet &itms) +void UBBoardController::findUniquesItems(const QUndoCommand *parent, QSet &items) { if (parent->childCount()) { for (int i = 0; i < parent->childCount(); i++) { - findUniquesItems(parent->child(i), itms); + findUniquesItems(parent->child(i), items); } } @@ -1657,16 +1657,26 @@ void UBBoardController::findUniquesItems(const QUndoCommand *parent, QSetparentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type())) - itms.insert(item); + if (!items.contains(item) && + !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type()) && + !items.contains(item->parentItem()) + ) + { + items.insert(item); + } } QSetIterator itRemoved(cmd->GetRemovedList()); while (itRemoved.hasNext()) { QGraphicsItem* item = itRemoved.next(); - if( !itms.contains(item) && !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type())) - itms.insert(item); + if (!items.contains(item) && + !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type()) && + !items.contains(item->parentItem()) + ) + { + items.insert(item); + } } } diff --git a/src/board/UBBoardController.h b/src/board/UBBoardController.h index 360e2e71..2f95ed88 100644 --- a/src/board/UBBoardController.h +++ b/src/board/UBBoardController.h @@ -177,7 +177,7 @@ class UBBoardController : public UBDocumentContainer void notifyPageChanged(); void displayMetaData(QMap metadatas); - void findUniquesItems(const QUndoCommand *parent, QSet &itms); + void findUniquesItems(const QUndoCommand *parent, QSet &items); void ClearUndoStack(); void setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, int pSceneIndex = 0, bool forceReload = false, bool onImport = false);