[Qgis-developer] Memory provider saver and signals
Chris Crook
ccrook at linz.govt.nz
Sun Dec 19 14:18:57 EST 2010
Hi All
I'm trying to find some good signals for identifying changes to data in a memory layer.
I've got a functional memory provider plugin, at the moment saving each memory layer to a GML file. However I'm not sure I've got the best approach to identifying when data changes are made to memory layers so that I can identify when the layers need to be updated.
The best I've got so far is
QObject.connect(layer, SIGNAL("committedAttributesDeleted(const QString &, const QgsAttributeIds )"),self.setProjectDirty2)
QObject.connect(layer, SIGNAL("committedAttributesAdded(const QString &, const QList<QgsField> &)"),self.setProjectDirty2)
QObject.connect(layer, SIGNAL("committedFeaturesDeleted(const QString &, const QgsFeatureIds & )"),self.setProjectDirty2)
QObject.connect(layer, SIGNAL("committedFeaturesAdded(const QString &, const QgsFeatureIds &)"),self.setProjectDirty2)
QObject.connect(layer, SIGNAL("committedAttributeValuesChanges(const QString &, const QgsChangedAttributesMap &)"),self.setProjectDirty2)
This works (at least for user changes - it won't identify changes made by other plugins, for example). But it does seem a bit cumbersome.
I'd hoped find something directly from the provider, since this would also identify programmatic data changes. I thought I was onto something when I saw
QgsDataProvider.dataChanged()
>From its name this seemed perfect, but the documentation states it is for a different purpose - asynchronous tasks registering completion of data changes :-( And looking through the memory provider code, I can't see any signals being emitted.
I'd also thought that using QgsVectorLayer.layerModified(bool) might have been a bit more succinct. But that gets triggered more often than I want.
Is there any obvious signal I'm missing?
Thanks
Chris
______________________________________________________________________________________________________
This message contains information, which is confidential and may be subject to legal privilege.
If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message.
If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz) and destroy the original message.
LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ.
Thank you.
______________________________________________________________________________________________________
More information about the Qgis-developer
mailing list