views:

47

answers:

2

How can I access the QUndoStack of a QTextDocument?

(For example, I want to be able to add custom QUndoCommand objects to the document's undo stack)

+1  A: 

I have been reading the documentation and it doesn't seems to be a way to get the QUndoStack directly for the Widget.

Probably the only way is to create your own QUndoStack object and manually add the changes and then reimplement the do / undo slots. I would have a look to the source code, you can probably get most of the code you need from there to store the changes in QTextDocument.

cnebrera
A: 

There is no way :(

The way I used is modifying QTextDocument Class for my needs and then recompile Gui module.

The static linking is a good choice for this purpose.

Razi