PDA

View Full Version : QGraphicsItemGroup bounding rect problem



jonks
27th October 2010, 15:03
If you drag a QGraphicsItem across a scene and then query it's bounding rect you will see that it's x,y co-ordinates are updated each time it is dragged.

Do the same with a QGraphicsItemGroup, and it's bounding rect x,y co-ordinate is not updated.

It appears to me that to update a QGraphicsItemGroup bounding rect you have to destroy the group then re-create it.

The problem I'm having right now is, when using the command pattern for undo/redo dragging QGraphicsItemGroup items, it does not work because the bounding rect is never accurate.

Is this a Qt bug, or am I misunderstanding the co-ordinate system when using QGraphicsItemGroups?

wysota
27th October 2010, 15:13
If you drag a QGraphicsItem across a scene and then query it's bounding rect you will see that it's x,y co-ordinates are updated each time it is dragged.
No, they are not.

jonks
28th October 2010, 04:02
Thank you - you identified the mistake in my thoughts and now I know why my groups bounds are never updated.