Hello,
I've been using the Qt example project, undoframework, as a method for implementing undo/redo.
It has worked great for moves, rotations, resizes, creations, and deletions.
The approach uses lists of graphics items (QList<QGraphicsItems *>) for the redo and undo methods.
I've encountered an error with undo/redo with creating groups demonstrated by the following sequence:
1) create 2 items
2) create group from the 2 items
3) move group
4) undo 2 times (to where 2 items are just created)
5) redo (group operation)
6) redo (move operation) <<--- error, new group item doesn't match move's redo item
I create the group using QGraphicScene's createItemGroup() command. This creates a new pointer for the group each time it's called.
The move operation maintains a list of graphics items (the group item in this instance). Since, the group item pointer is different, an error occurs when re-doing the move operation.
Thanks,
Ben
Bookmarks