Important: Please read the Qt Code of Conduct -

GraphicsView: Unobscured part of an Item

  • 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

    1. Start with a resultRect based on my own bounding rect
    2. Get the list of colliding items
    3. For each colliding item, check whether it's in front or behind my item
    4. 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?

Log in to reply