|
|
@ -29,6 +29,7 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent |
|
|
|
|
|
|
|
|
|
|
|
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
|
|
|
|
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item) |
|
|
|
void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item) |
|
|
@ -42,6 +43,19 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item) |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Check if group is allready rotatable or flippable
|
|
|
|
|
|
|
|
if (childItems().count()) { |
|
|
|
|
|
|
|
if (UBGraphicsItem::isFlippable(this) && !UBGraphicsItem::isFlippable(item)) { |
|
|
|
|
|
|
|
mDelegate->setFlippable(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (UBGraphicsItem::isRotatable(this) && !UBGraphicsItem::isRotatable(item)) { |
|
|
|
|
|
|
|
mDelegate->setRotatable(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
mDelegate->setFlippable(UBGraphicsItem::isFlippable(item)); |
|
|
|
|
|
|
|
mDelegate->setRotatable(UBGraphicsItem::isRotatable(item)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// COMBINE
|
|
|
|
// COMBINE
|
|
|
|
bool ok; |
|
|
|
bool ok; |
|
|
|
QTransform itemTransform = item->itemTransform(this, &ok); |
|
|
|
QTransform itemTransform = item->itemTransform(this, &ok); |
|
|
@ -80,7 +94,7 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item) |
|
|
|
// ### Expensive, we could maybe use dirtySceneTransform bit for optimization
|
|
|
|
// ### Expensive, we could maybe use dirtySceneTransform bit for optimization
|
|
|
|
|
|
|
|
|
|
|
|
item->setTransform(newItemTransform); |
|
|
|
item->setTransform(newItemTransform); |
|
|
|
// item->d_func()->setIsMemberOfGroup(true);
|
|
|
|
// item->d_func()->setIsMemberOfGroup(true);
|
|
|
|
prepareGeometryChange(); |
|
|
|
prepareGeometryChange(); |
|
|
|
itemsBoundingRect |= itemTransform.mapRect(item->boundingRect() | item->childrenBoundingRect()); |
|
|
|
itemsBoundingRect |= itemTransform.mapRect(item->boundingRect() | item->childrenBoundingRect()); |
|
|
|
update(); |
|
|
|
update(); |
|
|
@ -270,6 +284,27 @@ void UBGraphicsGroupContainerItem::pRemoveFromGroup(QGraphicsItem *item) |
|
|
|
|
|
|
|
|
|
|
|
QGraphicsItem *newParent = parentItem(); |
|
|
|
QGraphicsItem *newParent = parentItem(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (childItems().count()) { |
|
|
|
|
|
|
|
if (!UBGraphicsItem::isFlippable(item) || !UBGraphicsItem::isRotatable(item)) { |
|
|
|
|
|
|
|
bool flippableNow = true; |
|
|
|
|
|
|
|
bool rotatableNow = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (QGraphicsItem *item, childItems()) { |
|
|
|
|
|
|
|
if (!UBGraphicsItem::isFlippable(item)) { |
|
|
|
|
|
|
|
flippableNow = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!UBGraphicsItem::isRotatable(item)) { |
|
|
|
|
|
|
|
rotatableNow = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!rotatableNow && !flippableNow) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mDelegate->setFlippable(flippableNow); |
|
|
|
|
|
|
|
mDelegate->setRotatable(rotatableNow); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// COMBINE
|
|
|
|
// COMBINE
|
|
|
|
bool ok; |
|
|
|
bool ok; |
|
|
|
QTransform itemTransform; |
|
|
|
QTransform itemTransform; |
|
|
|