PDA

View Full Version : QTextCursor::insertHtml() questions



24pm
20th October 2008, 08:46
I have to questions on QTextCursor::insertHtml():

1. QTextCursor::insertHtml() does not insert HTML comment! There is how I try to do this:
QTextCursor cursor = QTextEdit::textCursor();
cursor.insertHtml("<!-- wanted comment -->");

2. QTextCursor::insertHtml() does not work for preformated <div> or <p>. Allignment is of paragraph where we insert our HTML.
So, if cursor is in paragraph with left allignment, the inserted HTML block will be with left allignment too, regardless of its format.
The workaround with QTextCursor::insertBlock() will involve some painfull HTML parsing to get QTextBlockFormat with extra CPU time.