painter.
setRenderHint(QPainter::Antialiasing,
false);
QFont & font
= getDisplayFont
();
font.setFamily("Arial");
font.setPointSize(8);
document.setDefaultFont(font);
document.setHtml(text);
ZeSmileyController::get()->InsertSmiley(document);
document.setTextWidth(textRect.width());
context.
clip = QRect(0,
0, textRect.
width(), textRect.
height());
painter.translate(textRect.x(), textRect.y());
document.documentLayout()->draw(&painter, context);
painter.restore();
painter.setRenderHint(QPainter::Antialiasing, false);
QTextDocument & document = getDisplayDocument();
QFont & font = getDisplayFont();
font.setFamily("Arial");
font.setPointSize(8);
document.setDefaultFont(font);
document.setHtml(text);
ZeSmileyController::get()->InsertSmiley(document);
document.setTextWidth(textRect.width());
QAbstractTextDocumentLayout::PaintContext & context = getDisplayContext();
context.clip = QRect(0, 0, textRect.width(), textRect.height());
painter.translate(textRect.x(), textRect.y());
document.documentLayout()->draw(&painter, context);
painter.restore();
To copy to clipboard, switch view to plain text mode
I've come up with that implementation to display an HTML text paragraph.
I'm trying to display an ItemView of HTML items.
The performance are terrible at this point. Anyone has any idea to optimize this ? The paint event simply cannot lay the document at every painting event.
Bookmarks