1
votes

I have a QGraphicsItem that contains several other QGraphicsItems.

How can I ensure that those children items are drawn and clipped against parent item's rect when moving them?

1

1 Answers

3
votes

Use this:

item->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);

More information can be found at: http://doc.qt.nokia.com/4.7-snapshot/qgraphicsitem.html#GraphicsItemFlag-enum