Important: Please read the Qt Code of Conduct -

Loop through stacked QGrapicsItems

  • Let's assume that I have multiple QGraphicsItems laying on top of each other in a QGraphicsScene. I want to give the user the ability to select which ones he want to move. Which is the correct way to implement this feature?
    I as I also have different QGraphicsItems (like lines and text) on the scene I'd like not to modify the mouseMoveEvent() of each (subclass). Is there a common way to do this within the QGraphicsScene class so it simply routes the mouse events to the correct item?

    Thank you very much for your help.

  • you have to create an area where the user clicked and to see how many graphics items you have in this area yourself because the click will get only the top graphic item. also you can create a item bar on the side like in gimp (layers) where the user will be able to select a layer (graphic item) even if the item is under other graphic items... depending on the way that you want to approach but from my point of view having like a navigation bar is a lot easy.

  • Thank you very much for your suggestion. I think the navigational approach makes indeed a lot more sense.
    I will see where I go from here.

Log in to reply