PDA

View Full Version : Inhibiting child scaling from parent



sfpiano
11th September 2010, 00:18
I'm working on a simple, mspaint-style graphics editor. The 'big' thing I'm trying to add is selection boxes to individual items, not just the current thing being edited. I've created a SelectionBox class that subclasses QGraphicsAbstractShapeItem, I've also abstracted the various QGraphicsXItem classes. When I create a graphics item I also add a SelectionBox as a child of the item. Everything works correctly until I apply a scaling transformation to the graphics item which also causes the child SelectionBox to scale which I don't want. Is there a way to prevent the transformation from being applied to a child item?

SixDegrees
11th September 2010, 00:50
Try setting QGraphicsItem::ItemIgnoresTransformations on the item.

sfpiano
11th September 2010, 01:33
Thanks, that's what I was looking for.