Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
GraphicsView: Unobscured part of an Item
Asperamanca last edited by
I need to find out which part of my GraphicsItem is currently not obscured by any other item. It's okay to check the boundingRects only, and receive a rectangle for the area that is fully visible.
This is a bit trickier than expected. My only idea so far is
- Start with a resultRect based on my own bounding rect
- Get the list of colliding items
- For each colliding item, check whether it's in front or behind my item
- For each item in front of me, remove parts from the resultRect obscured by that item's boundingRect
Thing is, I haven't found any good method to do 3). ZValue is not enough (I often rely on the insertion order). And I'm missing a method that tells me which of two items is in front of the other. It sounds like I have to walk up and down the items tree to collect that information.
Any other suggestions?