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);