Some changes crash related

preferencesAboutTextFull
Ilia Ryabokon 12 years ago
parent 4ec54ee3a8
commit e232bbc900
  1. 29
      src/domain/UBGraphicsScene.cpp
  2. 1
      src/frameworks/UBCoreGraphicsScene.cpp

@ -1099,6 +1099,11 @@ void UBGraphicsScene::clearItemsAndAnnotations()
setDocumentUpdated(); setDocumentUpdated();
} }
bool isService(QGraphicsItem *item) {
return (item->type() == UBGraphicsDelegateFrame::Type)
|| (item->parentItem() && item->parentItem()->Type == UBGraphicsDelegateFrame::Type);
}
void UBGraphicsScene::clearItems() void UBGraphicsScene::clearItems()
{ {
deselectAllItems(); deselectAllItems();
@ -1113,9 +1118,13 @@ void UBGraphicsScene::clearItems()
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;
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); removeItem(item);
}
if (!inGroup || !isService(item)) {
removedItems << item; removedItems << item;
} }
} }
@ -1611,14 +1620,14 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
mFastAccessItems.removeAll(item); mFastAccessItems.removeAll(item);
if (group) // if (group)
{ // {
if (group->childItems().empty()) // if (group->childItems().empty())
{ // {
group->Delegate()->remove(); // group->Delegate()->remove();
UBCoreGraphicsScene::removeItemFromDeletion(group); // UBCoreGraphicsScene::removeItemFromDeletion(group);
} // }
} // }
} }
void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items) void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items)

@ -73,6 +73,7 @@ void UBCoreGraphicsScene::removeItem(QGraphicsItem* item, bool forceDelete)
QGraphicsScene::removeItem(item); QGraphicsScene::removeItem(item);
if (forceDelete) if (forceDelete)
{ {
qDebug() << "force delete is " << forceDelete;
deleteItem(item); deleteItem(item);
} }
setModified(true); setModified(true);

Loading…
Cancel
Save