Howto draw a selection frame that's visible in only one QGraphicsView?



  • I have a GraphicsScene that can potentially be visible in multiple Views. However, the selection should only be visible in the view the user is actually working in.

    How would I create a selection frame that's visible only in one view?
    Side note: Performance is an issue, since hundreds of items can be multi-selected.



  • Even though I did not try it I would say you can not do it.

    If your selection frame is part of the scene then all attached views showing that part of the scene where the selection frame is have to show it.

    So in order to achieve what you want I guess you have to draw your selection frame outside the scene and then forward its coordinates to the scene so the 'selected' elements can be selected. The drawing of the selection frame could occure on a transparent widget laying in front of your view ...

    Peer



  • I could always customize my paint method. If there was a way to find out which view I am currently painting to...



  • Btw, have you had a look into QGraphicsView::RubberBandDrag whether it maybe provides what you need?



  • I am aware of the rubber band, but I need full drawing capabilities.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.