Hi,
I'm creating an "align to top" function for the QGraphicsItem based objects in my application. If there is a QGraphicsItemGroup in the selection I want the group to align with the other objects. If I have 2 or more regular items it works fine, but if one of the items is a group it doesn't.
In the attached example when I create the group ( "2" & "1") it is positioned at (130, 150). The group reports the pos() and scenePos() as (0,0). If I then set the positions of all selected items to the same y value the group ends up at (130,160) instead of the (130, 10) which I was expecting.
item->setPos(item->x(), 10);
}
foreach(QGraphicsItem *item, selectedItems()) {
item->setPos(item->x(), 10);
}
To copy to clipboard, switch view to plain text mode
I've read the QGraphicsItemGroup docs several times, and I've googled and searched this site and I don't think I've missed anything too obvious. Any help you could provide is much appreciated!
Thanks,
B
scene-align.tar.gz
Bookmarks