aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2012-04-17 17:28:50 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-17 11:06:15 +0200
commite624c2d9b0940f0abc24ef7685238299fec5c36e (patch)
treec711593f566af4112c3ae8836229ec575e5a85e7 /src
parente5c04205903b7c413fe09be321fc4becf60a3c51 (diff)
Don't crash when calculating the implicit width of truncated lines.
Remember to call beginLayout() on the QTextLayout before creating lines or the layout data won't be allocated. Change-Id: Ic344ca376fc25e38c50078135deb02dee3afc4f1 Reviewed-by: Chris Adams <christopher.adams@nokia.com> Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquicktext.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 70a1551205..f34c062c98 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -913,12 +913,13 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const naturalWidth, qreal *cons
QTextLayout widthLayout(layoutText.mid(characterCount), scaledFont);
widthLayout.setTextOption(layout.textOption());
+ widthLayout.beginLayout();
for (; unwrappedLineCount <= maxLineCount; ++unwrappedLineCount) {
QTextLine line = widthLayout.createLine();
if (!line.isValid())
break;
}
-
+ widthLayout.endLayout();
*naturalWidth = qMax(*naturalWidth, widthLayout.maximumWidth());
}