[PyQt] QGraphicsView rubberband selection

Antonio Valentino antonio.valentino at tiscali.it
Fri Oct 30 14:40:39 GMT 2009


Il giorno Fri, 30 Oct 2009 15:19:25 +0100
Alexander Borghgraef <alexander.borghgraef.rma at gmail.com> ha scritto:

> On Fri, Oct 30, 2009 at 2:50 PM, Antonio Valentino <
> antonio.valentino at tiscali.it> wrote:
> 
> >
> >
> > Try to install the event filter in the scene
> >
> > self.gs.installEventFilter(self)
> >
> > and then
> >
> >        if event.type() == QEvent.GraphicsSceneMouseRelease:
> >            self.p0 = event.buttonDownScenePos(Qt.LeftButton)
> >            self.p1 = event.scenePos()
> >
> >
> > This should work for every view attached to the scene.
> >
> > To hold the selection one could add a rectangle in a "special"
> > GraphicsItemGroup.
> >
> >
> > > For the other readers, I'm still interested in how to get to the
> > > QGraphicsView's rubberband selection data, as I think that would
> > > be the most elegant solution.
> >
> >
> > ciao
> >
> > --
> > Antonio Valentino
> >
> 
> Hmm, this gives me an error:
> 
> > AttributeError: buttonDownScenePos
> >
> 
> 

Debian sid

Qt 4.5.3
PyQt4 4.6-1


-- 
Antonio Valentino


More information about the PyQt mailing list