Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Strictly Inside Rubberband Select?



  • Hello,

    In QGraphicsView/QGraphicsScene, the default rubber-band drag selection will select any QGraphicsItems that touches the selection rectangle. However, I would like to change it so that it only select QGraphicsItems whose bounding rectangle lies completely inside the selection rectangle.

    It seems like it'll be an overkill to over-ride all mouse related events just to add this tweak, however, I can't find any straight forward solution from the documentations. What is the simplest way to change the selection behavior?



  • look for QGraphicsView::setRubberBandSelectionMode ( Qt::ItemSelectionMode mode )


Log in to reply