[QGIS-Developer] Strange behaviour of geometryChanged event on object QgsVectorLayer
Bo Victor Thomsen
bo.victor.thomsen at gmail.com
Sat Dec 10 01:49:52 PST 2022
Hi list ..
If I define an event listener for event geometryChanged event on object
QgsVectorLayer in the Python console like this:
*=====================
*
*# event listener...
def feedback(fid, geom):
# print id and geometry wkt in the console
print ('id: {}, geometry: {}'.format(fid, geom.asWkt()))
# find layer
layer = iface.activeLayer()
*
*# connect listener to event on layer
layer.geometryChanged.connect(feedback)*
*======================
*
It works nicely, printing the id and the WKT of the object changed.
However, the event fires *3* times, thus printing the same message 3 times.
Why does it do that ? (And no, I haven't connected it 3 times to the
same event. If I connect it twice, I'll get *6* lines in the the
console. And I did the experiment with a new user profile).
Windows 10, QGIS 3.26.3
--
Med venlig hilsen / Best regards
Bo Victor Thomsen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20221210/b626b17f/attachment.htm>
More information about the QGIS-Developer
mailing list