I've created a test plug-in in QGIS successfully, but have had a hard time implementing a signal on a vector layer event (add or modify feature). I've add this to my initGUI method:
QObject.connect(self.iface.activeLayer(),SIGNAL("featureAdded(QgsFeatureId)"),self.addedGeometry)
and this definition:
def addedGeometry(self, intValue):
QMessageBox.information( self.iface.mainWindow(),"Info", "Hi!!!" )
I get the following error when I load my plug-in:
QObject.connect(self.iface.activeLayer(),SIGNAL("featureAdded(QgsFeatureId)"),self.addedGeometry)
TypeError: arguments did not match any overloaded call:
QObject.connect(QObject, SIGNAL(), QObject, SLOT(), Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type 'NoneType'
QObject.connect(QObject, SIGNAL(), callable, Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type 'NoneType'
QObject.connect(QObject, SIGNAL(), SLOT(), Qt.ConnectionType=Qt.AutoConnection): first argument of unbound method must have type 'QObject'
If anyone could help I would be very grateful! I can't find a lot of examples of implementing signals on QGIS objects.
No comments:
Post a Comment