In a QGraphicsScene, I have a background set with a few QGraphicsItems on top of it. These graphics items are of arbitrary shape. I’d like to make another QGraphicsItem, i.e. a circle, which when placed over these items will essentially show the background within this circle, instead of being filled with a color.
It would sort of be like having a background with multiple layers on top of it in photoshop. Then, using a circular marquee tool to delete all the layers on top of the background to show the background within the circle.
Or, another way to view it could be to have an opacity set, but this opacity affects items directly underneath it (but only within the ellipse) to show the background.
The following might work. It basically extends a normal
QGraphicsScenewith the ability to only render its background to anyQPainter. Then, your “cut out” graphics item just renders the scene background over top of the other items. For this to work, the cut out item would have to have the highest Z-value.