[Qgis-developer] PyQt VectorLayer signal
Bernhard Ströbl
bernhard.stroebl at jena.de
Thu Feb 21 02:11:44 PST 2013
Hi Matthias,
I also connected a slot to featureAdded but this also never gets called :-(
Connecting to editingStarted works, though. But in this plugin I need to
do something for each feature that is added to a layer so simply
catching editingStarted/editingStopped is not enough.
I will wait for your pull request to be accepted and retry then.
thanks
Bernhard
Am 20.02.2013 20:36, schrieb Matthias Kuhn:
> 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 8033 (20130221) __________
The message was checked by ESET Mail Security.
http://www.eset.com
More information about the Qgis-developer
mailing list