[QGIS-Developer] PyQGIS bindings for QgsVectorlayer::allowCommit() and QgsVectorLayer::setAllowCommit()

Martin Gunia martin.gunia at arbonaut.com
Tue Jan 26 01:02:15 PST 2021


Hi,

I am developing a QGIS plugin that listens to feature editing events and would perform some validation steps before changes are committed to the data source. If the validation fails, I would like the commit to be "aborted" so that editing session remains in place and the edit buffer is unaffected. In C++ I can do this by calling  QgsVectorLayer::setAllowCommit() from within the QgsVectorLayer::beforeCommitChanges() slot but this is not available from Python, seemingly on purpose (QgsVectorLayer::allowCommit() and QgsVectorLayer::setAllowCommit() are marked as SIP_SKIP in qgsvectorlayer.h) .

I would be interested to know what is the reason for skipping the two methods from the SIP bindings and whether they could be made available? If not judged too difficult or generally undesirable, I can try implementing and testing this myself.

Best regards,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210126/66ae860e/attachment.html>


More information about the QGIS-Developer mailing list