diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-05-31 11:40:54 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-05-31 11:40:54 (GMT) |
commit | b2244174dc4e1858954d7e21cf66bd010d7a8cb4 (patch) | |
tree | eb629b62de29c2611dff92429d21aa4f44cee0e3 /src/gui | |
parent | 817469519a784b1cc84f89cb3cb84f7560874f8e (diff) | |
download | Qt-b2244174dc4e1858954d7e21cf66bd010d7a8cb4.zip Qt-b2244174dc4e1858954d7e21cf66bd010d7a8cb4.tar.gz Qt-b2244174dc4e1858954d7e21cf66bd010d7a8cb4.tar.bz2 |
Revert behavior of QTextLayout::boundingRect() when line width is set
In change 817469519a784b1cc84f89cb3cb84f7560874f8e, there was a
behavioral change which can cause regressions, as the bounding rect of
the QTextLayout would previously return the set line width when this
was greater than the calculated natural text width. We revert to this
behavior to avoid regressions and add an autotest for it. When the
line width is not set (and si.width is equal to QFIXED_MAX), then we
will still return the natural text width.
Reviewed-by: Lars
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a1a17af..3f67408 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -858,7 +858,8 @@ QRectF QTextLayout::boundingRect() const const QScriptLine &si = d->lines[i]; xmin = qMin(xmin, si.x); ymin = qMin(ymin, si.y); - xmax = qMax(xmax, si.x+si.textWidth); + QFixed lineWidth = si.width < QFIXED_MAX ? qMax(si.width, si.textWidth) : si.textWidth; + xmax = qMax(xmax, si.x+lineWidth); // ### shouldn't the ascent be used in ymin??? ymax = qMax(ymax, si.y+si.height()); } |