[Qgis-developer] QgsMapCanvasItem and mouse events -- Python

Florian El Ahdab felahdab at gmail.com
Mon Nov 2 08:22:21 EST 2009


Hi

That's a good idea.
I will implement the canvas events for now...

...but I would really like to understand why those events are not delivered
to my objects. I think they should, and although it is not a big problem, I
wouldn't have to rewrite the tests needed to handle the canvasEvent... The
QGraphicsView should take care of this for me and send the event
automatically to the right objects.

Thanks.
Florian

On Mon, Nov 2, 2009 at 10:40 AM, Martin Dobias <wonder.sk at gmail.com> wrote:

> On Sun, Nov 1, 2009 at 10:54 PM, Florian El Ahdab <felahdab at gmail.com>
> wrote:
> > Hi Tim.
> >
> > Thanks for your answer.
> >
> > The renderComplete signal works perfectly with the code I sent, and my
> > items get refreshed correctly after the canvas is rendered. The SLOT
> > macro is not needed for the destination of the signal (but I don't
> > really know the details of PyQT...)
> >
> > My problem is about the mouse events. According to the QGraphicsItem
> > API documentation, if I override the mousePressEvent and
> > mouseReleaseEvent methods, my objects should get the corresponding
> > events without further settings... but they don't.
>
> Hi Florian,
>
> you should use canvasPressEvent, canvasReleaseEvent and
> canvasMoveEvent functions to track mouse cursor on map canvas.
>
> Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20091102/5135a5e1/attachment.html


More information about the Qgis-developer mailing list