Frage

my widget contains lots of QTextEdit controls. Actually all these QTextEdits are installed as item widgets for a QTreeWidget. all these controls are editable in place.

So, I need to implement a unified "undo stack", process control + "Z/Y" in my widget instead of each QTextEdit control. For this I have to take a record whenever a certain QTextEdit make a new undo item. So when I press control+Z, it will undo a QTextEdit control's editing(by invoking its undo() method), press again probably will undo another QTextEdit control's editing(by invoking its undo() method).

But when searched through the document,I found no such signal that notifies me that a new undo item is made for a QTextEdit. And I have no idea about the undo policy of a QTextEdit, sometime multiple keypress was compressed into one single undo item, so using a keypress eventfilter and record my own QUndoCommand probably not a good idea, not mentioned that QTextEdit provide its own convenient method undo()/redo().

How can I get arround this?

War es hilfreich?

Lösung

I guess QTextDocument::undoCommandAdded is the signal you're looking for.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top