I realise that this thread is fairly old, but i have ran into a similar problem using QT 4.5 on Windows.
I have a TextEdit with Textdocument, and when i print the document i programmatically append the line number in front of each block, like so:
...
documentCursor->beginEditBlock();
do{
documentCursor
->insertText
(QString("%1: ") .
arg(documentCursor
->blockNumber
()+1,
7,
10,
QChar(' ')));
}while(documentCursor
->movePosition
(QTextCursor::NextBlock));
documentCursor->endEditBlock();
}
document->print(&printer);
if (printLineNumbers) document->undo();
...
...
documentCursor->beginEditBlock();
do{
documentCursor->insertText(QString("%1: ")
.arg(documentCursor->blockNumber()+1,7,10,QChar(' ')));
}while(documentCursor->movePosition(QTextCursor::NextBlock));
documentCursor->endEditBlock();
}
document->print(&printer);
if (printLineNumbers) document->undo();
...
To copy to clipboard, switch view to plain text mode
now i would like to remove the last redo from the undo-stack, but i cant find a way to do this.
I know that it is possible to implement a custom Undo Stack... but i feel that this is not worth it just for this function.
Anyone have any ideas how i can clear the one redo command? I could trick it by adding a space or something at the end of the document and then undo that... but this isn't very elegant, since there would still be a redo option every time the user hits print.
Maybe something like pausing the undo redo for the document temporarily... but i haven't found anything like that....
Thanks
Eric
Bookmarks