From e1d6b323d474acc5cd70fd9a0b283326316f55a0 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 5 Jul 2012 12:40:13 +1000 Subject: [PATCH] Speed up Text construction with RichText Setting the page size to empty can short cut some unnecessary layouts triggered by QTextDocument/QTextDocumentLayout prior to the Text item requiring a layout. This rougly halves the construction time a Text item with RichText. Task-number: QTBUG-19728 Change-Id: I03e6d293d8e5ac40046aef41171ca5009b718546 Reviewed-by: Martin Jones --- src/quick/items/qquicktext.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index fa56521..c4373e6 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -1200,6 +1200,7 @@ void QQuickTextPrivate::ensureDoc() if (!extra.isAllocated() || !extra->doc) { Q_Q(QQuickText); extra.value().doc = new QQuickTextDocumentWithImageResources(q); + extra->doc->setPageSize(QSizeF(0, 0)); extra->doc->setDocumentMargin(0); extra->doc->setBaseUrl(q->baseUrl()); qmlobject_connect(extra->doc, QQuickTextDocumentWithImageResources, SIGNAL(imagesLoaded()), -- 2.7.4