aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/items/qquicktext.cpp2
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index bde9637ea0..1d2e70d519 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -1009,7 +1009,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
// If the horizontal alignment is not left and the width was not valid we need to relayout
// now that we know the maximum line width.
- if (!implicitWidthValid && lineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) {
+ if (!implicitWidthValid && unwrappedLineCount > 1 && q->effectiveHAlign() != QQuickText::AlignLeft) {
widthExceeded = false;
heightExceeded = false;
continue;
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index dfbd190a65..82a1e21764 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -902,6 +902,8 @@ void tst_qquicktext::hAlignImplicitWidth()
{
// HCenter Align
text->setHAlign(QQuickText::AlignHCenter);
+ text->setText("Reset"); // set dummy string to force relayout once original text is set again
+ text->setText("AA\nBBBBBBB\nCCCCCCCCCCCCCCCC");
QImage image = view.grabWindow();
const int left = numberOfNonWhitePixels(centeredSection1, centeredSection2, image);
const int mid = numberOfNonWhitePixels(centeredSection2, centeredSection3, image);
@@ -912,6 +914,8 @@ void tst_qquicktext::hAlignImplicitWidth()
{
// Right Align
text->setHAlign(QQuickText::AlignRight);
+ text->setText("Reset"); // set dummy string to force relayout once original text is set again
+ text->setText("AA\nBBBBBBB\nCCCCCCCCCCCCCCCC");
QImage image = view.grabWindow();
const int left = numberOfNonWhitePixels(centeredSection1, centeredSection2, image);
const int mid = numberOfNonWhitePixels(centeredSection2, centeredSection3, image);