开发者

Clipping child QGraphicsItems

开发者 https://www.devze.com 2023-02-05 11:38 出处:网络
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 t开发者_如何学Pythonhem?Us

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 t开发者_如何学Pythonhem?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号