[PyQt] QGraphicsView rubberband selection
alexander.borghgraef.rma at gmail.com
Thu Oct 29 15:53:04 GMT 2009
I've been writing an app which displays sequences of images, and allows for
the selection of regions of interest in them.
Display/playback works like a charm, basically I use a QGraphicsScene/View
setup with a QGraphicsPixmapItem in the scene,
which is then updated upon receiving the timeout signal of a timer. Pretty
Now for selection: one approach would be to subclass either the
QGraphicsView or the QGraphicsPixmapItem, overload the mouse
events, get the selection coordinates from that for further use and put a
QGraphicsRectItem on the scene on top of the selection.
Now, I noticed that QGraphicsView already has rubberband selection
implemented: when I set the View's DragMode to
QGraphicsView.RubberBandDrag, I get a nice rubberband rectangle when I drag
the mouse across the View. My problem here is
that I can't seem to figure out how to access the selection coordinates of
that rectangle. Is there some way of accessing this data?
There doesn't seem to be any getDragSelection( ) or some such function, but
then how does this work? Do I need to get it from the
underlying QGraphicsScene object? Help would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt