[Qgis-developer] wrapping changeAttributeValue between begin and end EditCommand

Luigi Pirelli luipir at gmail.com
Mon Mar 16 13:32:28 PDT 2015


I used a different approach attaching to end Editing action to do a
similar work.
The logic is, start editing, do modification, stop editing is
intercepted to save EditingBuffer and then roolback all modification.
Then process editing buffer to create values basing on a rule and them
I can add/change the modified records with a new editing session
without user interaction.

I don't know if this can ba applied to your use case.

regards, Luigi Pirelli

https://www.linkedin.com/in/luigipirelli
https://github.com/luipir
https://www.elance.com/s/edit/luigipirelli/

On 15 March 2015 at 15:04, francescoboccacci at libero.it
<francescoboccacci at libero.it> wrote:
>
> Hi all,
> i have a problem with beginEditCommand and endEditCommand wrapping.
> In my plugin i capture the layer.featureAdded signal :
> self.layer.featureAdded.connect(self.myfunction)
>  The scope of my function is to change attribute of the feature added
> according with some rules.
> I wrap self.layer.changeAttributevalue between
> self.layer.beginEditCommand('My custom value') and
> self.layer.endEditCommand() but when i added a feature i can't see in
> Undo/redo window the label My custom value but my value is changed.
> This cause a Qgis 2.8.2 crash when i try to rollback my changes.
>
> P.S If i comment my change values function and i write the code in a python
> console i can see  my beginEditCommand label and no crash happend.
>
> Anyone can help me?
>
> Thanks
>
> Francesco
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list