[QGIS-Developer] Create layer, start edit session, commit and end edit session does not get me completely out of edit session and get my pan cursor back
Catania, Luke A ERDC-RDE-GRL-VA CIV
Luke.A.Catania at erdc.dren.mil
Fri Mar 17 16:43:54 PDT 2023
I have written code that automatically creates an empty QgsVectorLayer, adds it to the layer panel; I add a call to vlayer.featureAdded.connect(self.check_size) on the created layer that starts an edit session as well as checks that my polygon is within a min and max size. The user can then use QGIS edit tools to add the feature. After one feature is added it commits the changes. This tool is to just draw an AOI so I want to auto close the edit session. Though the layer is no longer in edit mode, the edit bullseye cursor is still showing. It seems the edit mode is still in play. I can still draw on the canvas and the shaded polygon shows up as if I am in edit mode. I don't get an error. Why does not running commitChanges() completely get me out of edit mode. My fix sine I cannot figure this out is to run iface.actionPan().trigger() to get myself back in pan mode, but why does this not get done automatically.
If I use QGIS to create an empty layer, toggle editing on by selecting that option on the layer in the layer panel, add a feature, and then toggle editing off and select save when prompted, I get the pan cursor back and I am completely out of edit mode. What code do I need to run to accomplish this in python? I basically just use startEditing and commitChanges to start and end an edit session.
Thanks,
Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20230317/0fb5c9df/attachment.htm>
More information about the QGIS-Developer
mailing list