[PyQt] problem with QGraphicsItem

David Boddie david at boddie.org.uk
Mon Apr 12 01:50:53 BST 2010

On Tue, 6 Apr 2010 22:10:40 +0200, Philippe Crave wrote:

> I posted that question few days ago, but no answers. Maybe nobody use
> QGraphicItem. I do not know. I am new at pyqt (still reading the pyqt
> book !).
> Please, let me know if there is a better place to talk about
> QGraphicsItem, View, Scene, .... I will use it a lot during the next
> month. it's a great tool compare to what I was using before.

For some questions about the details of Qt features, the qt-interest mailing
list might be a good place to ask:


> here was my question,
> I use setClipRegion() in the paint() method of a QGraphicsItem.
> That Item has got many children. I would like to avoid repeating the
> setClipRegion() in all of them.
> Thus, I would like to know if it's possible to "propagate" that
> Clipping to the children, automatically.

A quick look in the documentation reveals the ItemClipsChildrenToShape flag:


This might be useful in your case because you seem to clip the children to
the rectangle occupied by your parent item.

It may be that you can't use the painting system directly to clip child items
and that setting this flag is the only way to clip them. You would have to
experiment a bit more, or take a look at the QGraphicsItem source code, to
verify this.


More information about the PyQt mailing list