PDA

View Full Version : QTextEdit insert html



abrahametalero
12th February 2011, 16:09
Hi

I'm trying to insert html to get properties like bold, underline, italic. But I have to do from html, because I relocated from html to bbcode, and according to what I found, I can not pass the html style property, so ignore that part ... So I'm putting the properties from the html, I'm using this code:


ui->Txt_POST->textCursor().insertHtml("<b>"+ui->Txt_POST->textCursor().selectedText()+"</b>");

But I don't know how to remove the tags (<b></b>) from html

Any suggestions?

Lykurg
12th February 2011, 17:41
Well I don't get your question... but to remove something from a string use QString::remove() or QString::replace().

abrahametalero
12th February 2011, 18:28
I know. But my problem is that I can't remove the tags <b></b> from the html of the QTextEdit...

How I can get the html of QTextEdit in a string to remove the tags?

Thanks for answering

Lykurg
12th February 2011, 18:43
See QTextEdit::toHtml().

abrahametalero
12th February 2011, 18:58
Thanks, that's what I needed