aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktext.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@jollamobile.com>2014-07-10 16:52:48 +1000
committerMartin Jones <martin.jones@jollamobile.com>2014-07-11 06:16:57 +0200
commitfc76abfa52be058ee97b836c2af59cc22f2ca626 (patch)
treee50e86bdc6973a381f1c20de43dc1971d52b41f0 /src/quick/items/qquicktext.cpp
parent0ea494437736c51eb089a5245f8aac551ce6f909 (diff)
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 <andrew.den.exter@qinetic.com.au>
Diffstat (limited to 'src/quick/items/qquicktext.cpp')
-rw-r--r--src/quick/items/qquicktext.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 7a4027890c..e26ad2769a 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;