[Qgis-developer] PyQt VectorLayer signal

Bernhard Ströbl bernhard.stroebl at jena.de
Tue Feb 19 00:47:46 PST 2013


Hi,

for a plugin I am trying to connect a slot to QgsVectorLayer's 
commitedFeaturesAdded signal (I assume this signal is emitted when the 
user toggles the editing status and any features have been added and are 
written back to the data source)

This is the code I tried

# old connector style, I tried both with and without "const" and "&.."
QtCore.QObject.connect(self.documentLayer, 
QtCore.SIGNAL("committedFeaturesAdded(const QString &layerId, const 
QgsFeatureList &addedFeatures)"), self.featuresCommited)

# new connector style 
self.documentLayer.committedFeaturesAdded.connect(self.featuresCommitted)

#this is the slot, I tried with and without slot decoration
@QtCore.pyqtSlot(QtCore.QString, list )
def featuresCommitted(self,  layerId,  addedFeatures):
     QtGui.QMessageBox.information(None, "featuresCommited", \
         str(len(addedFeatures)))

However my slot never gets called
any hint or running code examples appreciated.

I am using current master on Linux if that matters

Bernhard




__________ Information from ESET Mail Security, version of virus signature database 8024 (20130218) __________

The message was checked by ESET Mail Security.
http://www.eset.com




More information about the Qgis-developer mailing list