Hard to tell where the issue is without a minimal reproducible code
example...
Best always use the "with edit():" context instead of manually fiddling
around with startEditing/commitChanges.
And if you use functions that return success codes, make sure you check
them.
Cheers, Hannes
Am 18.03.23 um 00:43 schrieb Catania, Luke A ERDC-RDE-GRL-VA CIV via
QGIS-Developer:
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
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer
--
Johannes Kröger / GIS-Entwickler/-Berater
**********************************************
FOSSGIS Konferenz
15.-18. März 2023 in Berlin
https://fossgis-konferenz.de/2023/
WhereGroup-Beiträge auf der FOSSGIS
https://wheregroup.com/unternehmen/aktuelles/
**********************************************
WhereGroup GmbH
c/o KK03 GmbH
Lange Reihe 29
20099 Hamburg
Germany
Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11
johannes.kroe...@wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------------------------
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer