Hello.
How can I set text in QPlainTextEdit without clearing the undo/redo history?
Hello.
How can I set text in QPlainTextEdit without clearing the undo/redo history?
You can try
- access to the document
- create a text cursor
- select all text in the document
- delete selected text
- insert new text
Qt Code:
curs.removeSelectedText (); curs.insertText (newText);To copy to clipboard, switch view to plain text mode
A camel can go 14 days without drink,
I can't!!!
Furkan (20th July 2011)
Thank you so much. It works. But it also takes the empty document (When you remove selected text) into the undo/redo history.
delete the line
Qt Code:
curs.removeSelectedText ();To copy to clipboard, switch view to plain text mode
from my code
Last edited by mcosta; 20th July 2011 at 15:23. Reason: updated contents
A camel can go 14 days without drink,
I can't!!!
How could I not think about that!?
Thank you so much. It works perfect now!
I haven't tried it, but maybe using QCursor directly wont clear the history.
...too late.
Bookmarks