<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hard to tell where the issue is without a minimal reproducible
      code example...</p>
    <p>Best always use the "with edit():" context instead of manually
      fiddling around with startEditing/commitChanges.<br>
    </p>
    <p>And if you use functions that return success codes, make sure you
      check them.</p>
    <p>Cheers, Hannes<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Am 18.03.23 um 00:43 schrieb Catania,
      Luke A ERDC-RDE-GRL-VA CIV via QGIS-Developer:<br>
    </div>
    <blockquote type="cite"
      cite="mid:a3b9d978d8ef44ce84baf8d19e487dfd@erdc.dren.mil">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;}div.WordSection1
        {page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">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.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">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. 
          <o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Thanks,<o:p></o:p></p>
        <p class="MsoNormal">Luke<o:p></o:p></p>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Johannes Kröger / GIS-Entwickler/-Berater

**********************************************
FOSSGIS Konferenz
15.-18. März 2023 in Berlin
<a class="moz-txt-link-freetext" href="https://fossgis-konferenz.de/2023/">https://fossgis-konferenz.de/2023/</a>

WhereGroup-Beiträge auf der FOSSGIS
<a class="moz-txt-link-freetext" href="https://wheregroup.com/unternehmen/aktuelles/">https://wheregroup.com/unternehmen/aktuelles/</a>
********************************************** 

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

<a class="moz-txt-link-abbreviated" href="mailto:johannes.kroeger@wheregroup.com">johannes.kroeger@wheregroup.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.wheregroup.com">www.wheregroup.com</a>
Geschäftsführer:
Olaf Knopp, Peter Stamm 
Amtsgericht Bonn, HRB 9885
-------------------------------
</pre>
  </body>
</html>