aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-05-02 17:22:46 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2022-06-08 17:27:13 +0200
commitb7ea85417ffff4df0b9538c010e07238db24ab28 (patch)
tree5cec664cff26e424c1bea0d9fa7511c4ece4c6b4 /src/quick
parent24fedb7cd52a920ccdb0878e1547a30f71c949bd (diff)
Text: don't fall back to full-width layout if availableWidth == 0
If Text.width == Text.rightPadding, there is no space to render any text; but in that case, QQuickTextPrivate::availableWidth() returns 0: it's incorrect to fall back to layout.maximumWidth() and allow rendering the whole line. Prior to 6ec2693d4a3c95ca9ff0c349d3c587a7f1402c05 we were checking width() here, so let's do that again. Fixes: QTBUG-83413 Change-Id: I3ee3b49406577c3aa005a3ca3606308ff0a21d8d Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit 406ff6b53d02b8db4231e473982fe593fb1e48c6) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquicktext.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 98f2baade9..addb5a5685 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -971,7 +971,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
const qreal availWidth = availableWidth();
const qreal availHeight = availableHeight();
- lineWidth = q->widthValid() && availWidth > 0 ? availWidth : naturalWidth;
+ lineWidth = q->widthValid() && q->width() > 0 ? availWidth : naturalWidth;
maxHeight = q->heightValid() ? availHeight : FLT_MAX;
// If the width of the item has changed and it's possible the result of wrapping,