I have a graphics scene in which i add / remove graphics text items. I manage the adding / removing through my own undo stack.

I also want to manage the text item edits with my undo stack instead of the text item's undo functionality.
It is enough if I only write a wrapper around the text item's undo-redo.

I know there is a signal 'undoCommandAdded' in QTextDocument (which i can get from the graphics text item). But if the focus is on the graphics text item, i can directly call the undo/redo of the text item, in which case my undo stack is not notified that undo has happened. That might cause problems when I call undo though my stack.

If i understand correctly, the correct way is to disable the undo-redo in the text item completely and handle everything myself.
But this requires me to handle all the things that Qt already does, and I do not want to do that.

What is the correct solution?