diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2012-07-05 10:18:43 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-09 09:05:32 +0200 |
commit | 4598939ee2fad1238609ca43717199fd4e98c75f (patch) | |
tree | 9ffdcf451ad585f14b1eda8050e48d3298dec7f2 /tests | |
parent | 19c0a31319148d4ac716f7cb3295891b5a3b20d9 (diff) |
Speed up TextEdit construction time.
Defer setting content on the QTextDocument until componentComplete()
to avoid unnecessary layouts and move one time setup for the
text document from setContent to the constructor.
Reduces the construction time of a TextEdit with RichText textFormat
by about a third.
Change-Id: Idde0772063bf769cde984efddd68589c55a7431a
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 1e063cbaa0..c911715b44 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -2417,7 +2417,8 @@ void tst_qquicktextedit::canPaste() { QVERIFY(textEdit != 0); // check initial value - QTBUG-17765 - QQuickTextControl tc(0); + QTextDocument document; + QQuickTextControl tc(&document); QCOMPARE(textEdit->canPaste(), tc.canPaste()); #endif @@ -2435,7 +2436,8 @@ void tst_qquicktextedit::canPasteEmpty() { QVERIFY(textEdit != 0); // check initial value - QTBUG-17765 - QQuickTextControl tc(0); + QTextDocument document; + QQuickTextControl tc(&document); QCOMPARE(textEdit->canPaste(), tc.canPaste()); #endif @@ -3820,7 +3822,7 @@ void tst_qquicktextedit::remove() textEdit->setTextFormat(textFormat); textEdit->select(selectionStart, selectionEnd); - QSignalSpy selectionSpy(textEdit, SIGNAL(seletedTextChanged())); + QSignalSpy selectionSpy(textEdit, SIGNAL(selectedTextChanged())); QSignalSpy selectionStartSpy(textEdit, SIGNAL(selectionStartChanged())); QSignalSpy selectionEndSpy(textEdit, SIGNAL(selectionEndChanged())); QSignalSpy textSpy(textEdit, SIGNAL(textChanged())); |