From 57f593b96f2b1af21e7d84099d169d51f698672f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Date: Wed, 23 Jan 2013 14:18:28 +0100 Subject: [PATCH] Make HTML horizontal alignment work like in QtQuick 1 If the text width set is higher than the ideal width, there's no risk of wrapping, and thus we align the text based on the full width of the Text element. This matches the behavior in Qt Quick 1.1. Task-number: QTBUG-29262 Change-Id: Ib191e3dd9d17e3bea63ca7825708f53768960e26 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> --- src/quick/items/qquicktext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 5a97f77e56..934451e825 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -527,7 +527,7 @@ void QQuickTextPrivate::updateSize() } if (internalWidthUpdate) return; - if (wrapMode != QQuickText::NoWrap && q->widthValid()) + if (q->widthValid() && (wrapMode != QQuickText::NoWrap || extra->doc->idealWidth() < q->width())) extra->doc->setTextWidth(q->width()); else extra->doc->setTextWidth(extra->doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) -- GitLab