From 4d552815cf370c0d5abbbeb50ff1350b449e7bb2 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 4 Oct 2016 12:41:47 +0200 Subject: Fix plain text QStaticText with line breaks The layout isn't actually created until endLayout() or setLineWidth() is called. So in the case where this was not done, the height of the line would be 0, thus multiple lines would be placed on top of each other, at y == 0. [ChangeLog][QtGui][Text] Fixed QStaticText when manually breaking lines and no text width was set. Task-number: QTBUG-56346 Change-Id: I7f6ed6260545882f05fe39b21134315eca7401b9 Reviewed-by: Konstantin Ritt --- src/gui/text/qstatictext.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/text/qstatictext.cpp') diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index a10071490e..dbc2e6e558 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -622,6 +622,8 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p) if (textWidth >= 0.0) line.setLineWidth(textWidth); + else + line.setLineWidth(QFIXED_MAX); height += leading; line.setPosition(QPointF(0.0, height)); height += line.height(); -- cgit v1.2.3