[QGIS-Developer] Detect a Map Canvas Mouse Event
Catania, Luke A ERDC-RDE-GRL-VA CIV
Luke.A.Catania at erdc.dren.mil
Wed Apr 5 08:56:34 PDT 2023
Looking for something like
canvas.xyCoordinates.connect( self.canvasMoveEvent )
but that's from a 7 year old post so looks like xyCoordinates is not in QGIS 3.x
From: QGIS-Developer <qgis-developer-bounces at lists.osgeo.org> On Behalf Of Catania, Luke A ERDC-RDE-GRL-VA CIV via QGIS-Developer
Sent: Wednesday, April 5, 2023 11:53 AM
To: qgis-developer at lists.osgeo.org
Subject: Re: [QGIS-Developer] Detect a Map Canvas Mouse Event
I found
QgsMapToolEmitPoint , QgsMapTool and canvas.setMapTool(...)
So I declared my class as AoiSizeValidator(QgsMapToolEmitPoint)
But gave that a try and it gets me x,y, initially but when I select an add layer from the qgis edit menu, I guess it sets a new map tool so mine gets overridden. So looks like I need a different approach to get xy from the map canvas.
From: QGIS-Developer <qgis-developer-bounces at lists.osgeo.org<mailto:qgis-developer-bounces at lists.osgeo.org>> On Behalf Of Catania, Luke A ERDC-RDE-GRL-VA CIV via QGIS-Developer
Sent: Wednesday, April 5, 2023 11:27 AM
To: qgis-developer at lists.osgeo.org<mailto:qgis-developer at lists.osgeo.org>
Subject: [QGIS-Developer] Detect a Map Canvas Mouse Event
Trying to get a map canvas event when canvas is clicked and mouse is dragged. I have code that creates an empty layer, but I use the QGIS edit menu to add the actually layer. I want to be able to track the mouse movement so I can calculated the area of the feature being drawn in real time so I can make sure the area is within a defined range.
Is there an event I can connect to so I can run my custom code when the even occurs?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20230405/e4d7d789/attachment-0001.htm>
More information about the QGIS-Developer
mailing list