QWidgetTextControl: don't clear() a new empty document
Before: 0.063 msecs per iteration After: 0.054 msecs per iteration clear() takes time because: 1) QTextDocumentLayout::documentChanged() => doLayout() => layoutFrame() 2) QTextDocumentPrivate::init() => insertBlock() => finishEdit() => QTextDocumentLayout::documentChanged() => layoutStep() => ... => doLayout() again Pick-to: 6.3 6.2 Change-Id: I7a13164d06a1ed77226f2b9d7d12e69ce5b31dfe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>bb10
parent
367092d7e0
commit
42cf2a2617
|
|
@ -412,11 +412,11 @@ void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString
|
|||
if (!doc) {
|
||||
if (document) {
|
||||
doc = document;
|
||||
clearDocument = false;
|
||||
} else {
|
||||
palette = QApplication::palette("QWidgetTextControl");
|
||||
doc = new QTextDocument(q);
|
||||
}
|
||||
clearDocument = false;
|
||||
_q_documentLayoutChanged();
|
||||
cursor = QTextCursor(doc);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue