[PyQt] QGraphicsView rubberband selection
Alexander Borghgraef
alexander.borghgraef.rma at gmail.com
Thu Oct 29 15:53:04 GMT 2009
Hi all,
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
basic stuff.
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.
Thanks,
--
Alex Borghgraef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20091029/9e1e0832/attachment.html
More information about the PyQt
mailing list