I have a Qt Graphics Application that can draw QGraphicsItems like line, circle, ellipse, etc.

My entities are implemented using QGraphicsItemGroup. The particular groups are being added to the QList<QGraphicsItemGroup *>.

Now I want to implement undo/redo functionality to it. I have read that I can use Undo Framework(QUndoCommand, QUndoStack, etc.) for that but then I'd have to make use of command objects, which restricts my implementation to commands only.

Is there any other approach something like returning to previous state of the graphicsScene? Do I have to make custom functionality for undo/redo?