SANKORE-1063

The annotations are erased when you select the Erase items
preferencesAboutTextFull
Anatoly Mihalchenko 12 years ago
parent 0d1e848f4f
commit 3a21e07283
  1. 21
      src/domain/UBGraphicsScene.cpp

@ -1078,12 +1078,9 @@ void UBGraphicsScene::clearItemsAndAnnotations()
QSet<QGraphicsItem*> emptyList; QSet<QGraphicsItem*> emptyList;
QSet<QGraphicsItem*> removedItems; QSet<QGraphicsItem*> removedItems;
QListIterator<QGraphicsItem*> itItems(mFastAccessItems); QList<QGraphicsItem*> sceneItems = items();
foreach(QGraphicsItem* item, sceneItems)
while (itItems.hasNext())
{ {
QGraphicsItem* item = itItems.next();
if(!mTools.contains(item) && !isBackgroundObject(item)) if(!mTools.contains(item) && !isBackgroundObject(item))
{ {
removeItem(item); removeItem(item);
@ -1109,12 +1106,9 @@ void UBGraphicsScene::clearItems()
QSet<QGraphicsItem*> emptyList; QSet<QGraphicsItem*> emptyList;
QSet<QGraphicsItem*> removedItems; QSet<QGraphicsItem*> removedItems;
QListIterator<QGraphicsItem*> itItems(mFastAccessItems); QList<QGraphicsItem*> sceneItems = items();
foreach(QGraphicsItem* item, sceneItems)
while (itItems.hasNext())
{ {
QGraphicsItem* item = itItems.next();
bool isGroup = qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(item) != NULL; bool isGroup = qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(item) != NULL;
bool isPolygon = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item) != NULL; bool isPolygon = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item) != NULL;
bool isStrokesGroup = qgraphicsitem_cast<UBGraphicsStrokesGroup*>(item) != NULL; bool isStrokesGroup = qgraphicsitem_cast<UBGraphicsStrokesGroup*>(item) != NULL;
@ -1143,11 +1137,9 @@ void UBGraphicsScene::clearAnnotations()
QSet<QGraphicsItem*> emptyList; QSet<QGraphicsItem*> emptyList;
QSet<QGraphicsItem*> removedItems; QSet<QGraphicsItem*> removedItems;
QListIterator<QGraphicsItem*> itItems(mFastAccessItems); QList<QGraphicsItem*> sceneItems = items();
foreach(QGraphicsItem* item, sceneItems)
while (itItems.hasNext())
{ {
QGraphicsItem* item = itItems.next();
UBGraphicsStrokesGroup* pi = qgraphicsitem_cast<UBGraphicsStrokesGroup*>(item); UBGraphicsStrokesGroup* pi = qgraphicsitem_cast<UBGraphicsStrokesGroup*>(item);
if (pi) 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 // force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
update(sceneRect()); update(sceneRect());
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);

Loading…
Cancel
Save