Hello,
I'm having 3 (related) issues with grouping within the Qt Graphics Framework. These occur with either the QGraphicsItemGroup::addToGroup() or QGraphicsItem::setParentItem() grouping methods.
1) When you create a group within Qt, its initial position as reported by the pos() method is (0,0) independent of its child items' bounding rectangle. The group (when created) could be contained within the rectangle x=100, y=100, w=10, h=10 and it still has position of (0,0). This is not intuitive to the user; (0,0) isn't even within the bounding rectangle. The pos() should be the upper left (or center) of the bounding rectangle.
2) Rotating the group is relative to (0,0) -- not relative to the group's bounding rectangle.
3) There is no convenient way to get/set the actual scene-relative position and rotation for a child of a group. Moving the group has no effect on the position reported by the child pos() method. This is further complicated by the fact that QGraphicsItem uses two affine transformation systems: one for the setPos(), setRotation(), and setScale() methods and another for the setTransform() method. Coming from a gaming & simulation background, this is imho a completely non-standard way of handling transformations. This took my by surprise as most every other aspect of Qt employs industry common best practices.
Thanks,
Ben
Bookmarks