From: Martin Jones Date: Thu, 10 Jul 2014 06:52:48 +0000 (+1000) Subject: Binding Text width to implicitWidth can result in incorrect layout X-Git-Tag: v5.3.99+beta1~238^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc76abfa52be058ee97b836c2af59cc22f2ca626;p=platform%2Fupstream%2Fqtdeclarative.git Binding Text width to implicitWidth can result in incorrect layout If the text is not left aligned and the width changes during layout due to implictWidth changing, the text needs to be laid out again. Task-number: QTBUG-40161 Change-Id: I1ad679ccdc5595dd749600abe08ed46ac179d7bf Reviewed-by: Andrew den Exter --- diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 7a40278..e26ad27 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -940,9 +940,10 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) maxHeight = q->heightValid() ? q->height() : FLT_MAX; // If the width of the item has changed and it's possible the result of wrapping, - // eliding, or scaling has changed do another layout. + // eliding, scaling has changed, or the text is not left aligned do another layout. if ((lineWidth < qMin(oldWidth, naturalWidth) || (widthExceeded && lineWidth > oldWidth)) - && (singlelineElide || multilineElide || canWrap || horizontalFit)) { + && (singlelineElide || multilineElide || canWrap || horizontalFit + || q->effectiveHAlign() != QQuickText::AlignLeft)) { widthExceeded = false; heightExceeded = false; continue;