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

Martin Dobias wonder.sk at gmail.com
Mon Nov 2 04:40:27 EST 2009


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


More information about the Qgis-developer mailing list