[Qgis-developer] PyQt VectorLayer signal

Matthias Kuhn matthias.kuhn at gmx.ch
Wed Feb 20 11:36:33 PST 2013


Hi Bernhard,

I stumbled upon this also today.

It seems, that this signal is emitted nowhere, while the same signal is 
emitted by the edit buffer behind the vector layer.
While something like connecting your slot every time layer editing is 
started (needed, because the edit buffer gets deleted/created based on 
editing state) or connecting to featureAdded, which is also emitted may 
work, I've just issued a pull request to fix this [1].

Cheers,
Matthias

[1] https://github.com/qgis/Quantum-GIS/pull/432

On 02/19/2013 09:47 AM, Bernhard Ströbl wrote:
> 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
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer



More information about the Qgis-developer mailing list