From 3a21e07283c4b224ad81425d137d7d1cc9d49e92 Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Mon, 3 Sep 2012 19:27:15 +0300 Subject: [PATCH] SANKORE-1063 The annotations are erased when you select the Erase items --- src/domain/UBGraphicsScene.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index a34d8aac..37ab5bef 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1078,12 +1078,9 @@ void UBGraphicsScene::clearItemsAndAnnotations() QSet emptyList; QSet removedItems; - QListIterator itItems(mFastAccessItems); - - while (itItems.hasNext()) + QList sceneItems = items(); + foreach(QGraphicsItem* item, sceneItems) { - QGraphicsItem* item = itItems.next(); - if(!mTools.contains(item) && !isBackgroundObject(item)) { removeItem(item); @@ -1109,12 +1106,9 @@ void UBGraphicsScene::clearItems() QSet emptyList; QSet removedItems; - QListIterator itItems(mFastAccessItems); - - while (itItems.hasNext()) + QList sceneItems = items(); + foreach(QGraphicsItem* item, sceneItems) { - QGraphicsItem* item = itItems.next(); - bool isGroup = qgraphicsitem_cast(item) != NULL; bool isPolygon = qgraphicsitem_cast(item) != NULL; bool isStrokesGroup = qgraphicsitem_cast(item) != NULL; @@ -1143,11 +1137,9 @@ void UBGraphicsScene::clearAnnotations() QSet emptyList; QSet removedItems; - QListIterator itItems(mFastAccessItems); - - while (itItems.hasNext()) + QList sceneItems = items(); + foreach(QGraphicsItem* item, sceneItems) { - QGraphicsItem* item = itItems.next(); UBGraphicsStrokesGroup* pi = qgraphicsitem_cast(item); if (pi) { @@ -1159,7 +1151,6 @@ void UBGraphicsScene::clearAnnotations() // force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint update(sceneRect()); - if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); UBApplication::undoStack->push(uc);