PDA

View Full Version : QTextEdit format html code



Edder
14th July 2012, 13:55
Hi community,

is it possible with qtextedit (or any other text viewer/editor like qtextbrowser) to format html code?

I mean like that:


textedit->textCursor().insertHtml("<i><b>");
textedit->textCursor().insertText("<img src='image.jpg' />");
textedit->textCursor().insertHtml("</i></b>");

This should be the output:
<img src='image.jpg' />

Of course it doesnt work, the output is:
<img src='image.jpg' />

How to achieve that html code ist displayed as plaintext but also formatted (well then it wouldn't be plaintext)?

wysota
14th July 2012, 16:03
Set the document to plain text mode and use QTextFormat and family to format it.