[Interest] how to transfer text+formatting (created QSyntaxHighlighter) of QPlainTextEdit to the clipboard?

Alexander.Heinz at infineon.com Alexander.Heinz at infineon.com
Mon Apr 16 11:27:32 CEST 2012


Hello!

I use Qt 4.5. I have subclassed QSyntaxHighlighter and highlighting works as expected. The syntax highlighter is used with QPlainTextEdit.

In my application I would also like to be able to copy the content of QPlainTextEdit to the clipboard. I would like to keep the formatting created by the syntax highlighter and I did not manage to do so. The formatting is lost if I use toPlainText.

I also tried to use QTextEdit with toHtml() instead. This also did not lead to the desired result.

What is the suggested way of transferring the content (incl formatting) to the clipboard?

Thank you very much!

Best regards,
Alex



More information about the Interest mailing list