[PyQt] ScrollHandDrag problem with items getting selected while scrolling

Simon Hibbs simon.hibbs at gmail.com
Thu Dec 31 14:12:05 GMT 2009


I am setting ScrollHandDrag mode on a view so that I can move around
the scene, but clicking with the hand is also causign items to get
selected. I would like to be able to select some items, switch to
ScrollHandDrag mode, pan the view without changing the selection, then
switch back to selection mode so that I can select some more items.

I can't disable item selection when switching to ScrollHandDrag mode
because that works at the item level, and all the items will get
unselected.

I'm guessing what I need to do is temporarily filter out mouse events
on the scene (QGraphicsScene.eventFilter), but this method isn't
documented and I can't figure out how it's supposed to work and I'm
concerned that it would prevent scroling by interfering with mouse
events needed to acheive it.

Idealy I'd like to be able to disable processing of item selection
activity, without affecting the current selection state of items. Does
anyone know of an elegant way to achieve this?

Best regards,

Simon Hibbs


More information about the PyQt mailing list