[Qgis-developer] Plugin. Get a signal when the geometry is changed

Stig Henning Fredheim stighenning at tradlosetrondheim.no
Fri Jul 13 02:36:40 PDT 2012


Hi.

I hope this is the right place to send this.

I am working on a plugin in QGIS and want to get a signal when the geometry
to a feature(in this case a polyline) in my layer is changed. For example
if I use the node tool to drag one of the nodes.

I have posted the question on stackexchange, but I have not got a answer
that solved it.
http://gis.stackexchange.com/questions/29306/how-to-get-a-signal-when-the-geometry-to-a-line-in-qgis-is-changed


I have tried to use both the old and the new style:

QObject.connect(self.iface.activeLayer(),SIGNAL("geometryChanged(qint64,QgsGeometry)"),self.changedGeometry)
Here the program don't crash but I don't get the message when the geometry
changes

self.iface.activeLayer().geometryChanged.connect(self.changedGeometry)
Here I get this error: "TypeError: connect() failed between
geometryChanged(qint64,QgsGeometry) and unislot()"

def changedGeometry(self, intValue, qgsGeom):
        QMessageBox.information(self.iface.mainWindow(),"Message", "Changed
geometry. intValue: " + str(intValue) + "qgsGeom: " + str(qgsGeom))

in the top of the file I have these imports:
    from PyQt4.QtCore import *
    from PyQt4.QtGui import *
    from qgis.core import *
    from qgis.gui import *


Regards
Stig Henning Fredheim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120713/57d2eae0/attachment.html>


More information about the Qgis-developer mailing list