[Interest] QTextDocument and Undo

Rainer Wiesenfarth rainer_wiesenfarth at trimble.com
Fri Jul 1 09:17:15 CEST 2016

2016-07-01 9:01 GMT+02:00 Igor Mironchik <igor.mironchik at gmail.com>:
> What if I create Text, then change text in it, then make two undo commands?!
> It undo changing text and creation of Text item. Ok. But...
> Then I want to redo this two commands. I redo "create", so Text item now is
> created again, then I redo "text change" that implemented with
> QGraphicsTextItem::document()->redo(). But...
> But Text item with its QTextDocument was created again so QTextDocument's
> undo stack is empty. I.e. redo() does nothing.

I am not sure if this will work (it has been some time since I used
undo/redo), but can't you keep the created text item, including it's
undo stack until the text-item-create-command is _deleted_ (not only
undone)? Or is this approach what you mean by "Implement your own undo
commands for text interactions in Text item?"

Software Engineer | Trimble Imaging Division
Rotebühlstraße 81 | 70178 Stuttgart | Germany
Office +49 711 22881 0 | Fax +49 711 22881 11
http://www.trimble.com/imaging/ | http://www.inpho.de/

Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim
Eingetragen beim Amtsgericht Darmstadt unter HRB 83893,
Geschäftsführer: Dr. Frank Heimberg, Hans-Jürgen Gebauer

More information about the Interest mailing list