QGIS Editing – How to Undo a Single Edit in QGIS Attribute Table

editingqgisundo/redo

In QGIS 3.18. When in Edit Mode, there does not seem to be an obvious way of undoing a single edit to the Attribute Table. For example, if I change the value of Attribute 1 for Feature A from 'XYZ' to 'ABC', I don't seem to have the option of undoing to get 'XYZ' back. The Attribute Table doesn't have an Undo button, and the Undo button for the project doesn't do anything to my Attribute Table edits, nor does Ctrl+Z.

This can be a major problem for me if I've made an editing error, I'm not sure what value was in the cell before my edit, and the only way to get it back appears to be exiting Edit mode and not saving my changes. I've lost a lot of time and work that way (yes, I could save changes after every single edit but that is not realistic or practical). [As a side note, this is especially frustrating when I accidentally click that little "X arrow" inside each cell on the right, which deletes the value of the cell. Many times I simply wish to edit the value, but end up deleting it and not being able to get it back.]

This question has been asked before: here, for example (a closed thread from many years ago). But am I mistaken, or has this issue not yet been solved?

Best Answer

QGIS does have support for Undo/Redo in the main window's Edit menu, and in the Digitizing toolbar (the usual curved arrow to left and right icon). While those icons and menu items are not present in the Attribute Editor window itself, you can use them to affect attribute editor changes if you navigate back to the main window while keeping the Attribute Editor window open. I have just tested with a gpkg layer and it works, except that the attribute editor may not correctly display the undo reversion has taken place until you navigate to a different record (it seems it does not receive a signal that field info has changed).

More importantly, QGIS implements an edit buffer for layer edits, so you could always shut down editing mode, not commit changes. Then you would roll back everything since the last layer (not project) save or commit.

Related Question