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

Martin Dobias wonder.sk at gmail.com
Tue Nov 3 08:12:00 EST 2009


On Tue, Nov 3, 2009 at 2:03 PM, Florian El Ahdab <felahdab at gmail.com> wrote:
> Hi.
> Thanks for coming back to me about this issue.
> Yes, I went through the sources of Qgis to discover the reason of my
> problem.
> The mouse events are propagated to the active map tool unless some boutons
> are pressed which trigger a pan, except for the MouseMoveEvent which is
> converted into the xyCoordinates signal available for everyone.
> The key events are converted into Qt signals (KeyPressed and KeyReleased)
> and propagated.
> If I understand currectly, there is no way for a user to override this
> behaviour so as to catch all events related to the canvas (Except subclass
> the QgsMapCanvas to get all the events... which is only possible in a custom
> app I presume, not in QGis with a plugin).

That's right. If you need to interact with map canvas items, you can
simply create a map tool which will implement the functionality you
need.

Martin


More information about the Qgis-developer mailing list