Marco,

many thanks, that does the trick!

Bernhard

Am 07.03.2012 10:48, schrieb Marco Hugentobler:
Hi Bernhard

Use QgsVectorLayer::beginEditCommand before adding the feature, then
endEditCommand or destroyEditCommand after.

Regards,
Marco

On 07.03.2012 10:40, [email protected] wrote:
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
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer



--
Bernhard Ströbl
Anwendungsbetreuer GIS

Kommunale Immobilien Jena
Am Anger 26
07743 Jena

Tel.: 03641 49- 5190
E-Mail: [email protected]
Internet: www.kij.de



Kommunale Immobilien Jena
Eigenbetrieb der Stadt Jena
Werkleiter: Thomas Dirkes


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to