I want to receive a signal when changes have been made to a layer, regardless of the type of editing (add features, remove features, change attributes). When I receive this signal I export the layer's data to an excel sheet. I've looked at these signals:

layer.dataProvider().dataChanged: Well, nothing seems to happen here when I start and end an editing session in the layer.

layer.attributeValueChanged: seems to be emitted before changes are committed to the data provider. When I export to excel, the columns for edited features are shifted to the right: If the un-edited data is in columns A..D, the edited data is in columns E..H instead. Is this the "editing buffer representation"?

layer.beforeCommitChanges: same outcome as above: edited features don't occupy the same columns as the un-edited ones.

What I want is probably something like layer.afterCommitChanges, but I can't find anything like that. There are step-by-step signals such as committedAttributesAdded, committedFeaturesAdded and so on but I don't think that catching all of those is the way to go.

I'm using XlsxWriter to write the excel file. Maybe the problem is related to this choice?

  • 1
    I guess what you're looking for doesn't exist (already). You're on the right track aiming at committed... SIGNALs. Since you are developing in Python, you can make the most of some of its characteristics to write a single SLOT that gets connected to all committed... SIGNALS. Don't really know how 'elegant' it is, but you can find a simple example at How can I make an attribute table field automatic?. Let me know if you face any issue. Jul 24 '16 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.