QGraphicsItem's child items always on top
I have a scene with some QGraphicsItems (let's call them "groups"), which contains some other graphics items as children.
The groups have all a background color or image and the same z-value (= 1), but they are painted in creation order. You can see which is painted last, when the groups overlap.
Now, the child items within these groups have a higher z-value (= 10) than the groups themselves. But the child items are also overlapped by other groups.
It seems to me the correct way how this is working, but for my case I want the child items to stay on top of all groups. It this possible?
the docu says "The Z value decides the stacking order of sibling (neighboring) items". Siblings are items that have the same parent (I would assume), in your case: the groups.
So I would say that one group that covers another group always also covers the children of the other group. The z=10 of the children just affects the children within the group (they are siblings). But you could as well not set it as the children are on top of their parents, by default, anyway.
You can use the following flags to influence this behavior: QGraphicsItem::ItemStacksBehindParent and QGraphicsItem::ItemNegativeZStacksBehindParent