[Qgis-developer] Undo/Redo when adding/changing features from Python

bernhard.stroebl at jena.de bernhard.stroebl at jena.de
Wed Mar 7 04:40:09 EST 2012


Dear list,

I am currently doing a Python plugin that adds/changes features in an 
editable QgsVectorLayer:

<code>
# case 1 change
myLayer.changeGeometry(myFid, newGeometry)
# case 2 add
if self.iface.openFeatureForm(myLayer, newFeature):
   myLayer.addFeature(newFeature)
</code>

The Undo/Redo Window does not list anything to undo in case 1 (change) 
and only the attributes changed if I accept the featureForm in case 2.
I would expect "Feature changed" in case 1 and "Feature added" in case 
2. If I digitize a feature the feature form pops up as soon I have 
finished digitizing and accepting it gives me a "Feature added"-undo option.
I found the QgsUndoCommand class in the docs but get a
NameError: name 'QgsUndoCommand' is not defined

any help appreciated

Bernhard



________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com


More information about the Qgis-developer mailing list