Grouped items doesn't manages by mFastAccessItems now.

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent 0b108d466a
commit 4b7939b6c3
  1. 5
      src/board/UBBoardController.cpp
  2. 6
      src/domain/UBGraphicsGroupContainerItem.cpp
  3. 4
      src/domain/UBGraphicsPolygonItem.cpp
  4. 11
      src/domain/UBGraphicsScene.cpp

@ -1482,11 +1482,12 @@ void UBBoardController::ClearUndoStack()
UBGraphicsItemUndoCommand *cmd = (UBGraphicsItemUndoCommand*)UBApplication::undoStack->command(i);
// go through all added and removed objects, for create list of unique objects
// grouped items will be deleted by groups, so we don't need do delete that items.
QSetIterator<QGraphicsItem*> itAdded(cmd->GetAddedList());
while (itAdded.hasNext())
{
QGraphicsItem* item = itAdded.next();
if( !uniqueItems.contains(item) )
if( !uniqueItems.contains(item) && !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type()))
uniqueItems.insert(item);
}
@ -1494,7 +1495,7 @@ void UBBoardController::ClearUndoStack()
while (itRemoved.hasNext())
{
QGraphicsItem* item = itRemoved.next();
if( !uniqueItems.contains(item) )
if( !uniqueItems.contains(item) && (item->parentItem() && UBGraphicsGroupContainerItem::Type != item->parentItem()->type()))
uniqueItems.insert(item);
}
}

@ -324,6 +324,12 @@ void UBGraphicsGroupContainerItem::pRemoveFromGroup(QGraphicsItem *item)
item->setParentItem(newParent);
item->setPos(oldPos);
UBGraphicsScene *Scene = dynamic_cast<UBGraphicsScene *>(item->scene());
if (Scene)
{
Scene->addItem(item);
}
// removing position from translation component of the new transform
if (!item->pos().isNull())
itemTransform *= QTransform::fromTranslate(-item->x(), -item->y());

@ -67,8 +67,8 @@ void UBGraphicsPolygonItem::clearStroke()
if (mStroke!=NULL)
{
mStroke->remove(this);
if (mStroke->polygons().empty())
delete mStroke;
//if (mStroke->polygons().empty())
// delete mStroke;
mStroke = NULL;
}
}

@ -1374,9 +1374,11 @@ UBGraphicsGroupContainerItem *UBGraphicsScene::createGroup(QList<QGraphicsItem *
}
foreach (QGraphicsItem *chItem, childItems) {
groupItem->addToGroup(chItem);
mFastAccessItems.removeAll(item);
}
} else {
groupItem->addToGroup(item);
mFastAccessItems.removeAll(item);
}
}
@ -1396,6 +1398,15 @@ UBGraphicsGroupContainerItem *UBGraphicsScene::createGroup(QList<QGraphicsItem *
void UBGraphicsScene::addGroup(UBGraphicsGroupContainerItem *groupItem)
{
addItem(groupItem);
for (int i = 0; i < groupItem->childItems().count(); i++)
{
QGraphicsItem *it = qgraphicsitem_cast<QGraphicsItem *>(groupItem->childItems().at(i));
if (it)
{
mFastAccessItems.removeAll(it);
}
}
groupItem->setVisible(true);
groupItem->setFocus();

Loading…
Cancel
Save