diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2012-05-24 15:40:16 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-30 16:34:25 +0200 |
commit | 5131aefc1f0c04936e3ef19c9870d884775471e5 (patch) | |
tree | 8565120d7fbf24b60f14f99de94c4f0f59e623ae | |
parent | 60fb770fa779864015f728556857b1d70398fb74 (diff) |
Fix text decoration width rounding
width passed in qreal should be set with setWidthF instead of
setWidth, otherwise the fractional part is lost.
Also remove the raster paint engine hack that has been removed in
Qt 4.8, it's no longer needed.
This fixed the drawUnderline and drawRightToLeft auto tests in
tst_qglyphrun.
Change-Id: Iace46fc27ff156c07fb4d08a145269fad36e9fdb
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
-rw-r--r-- | src/gui/painting/qpainter.cpp | 3 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 2a793a131e..ed08162c1c 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -6177,8 +6177,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const const qreal underlineOffset = fe->underlinePosition().toReal(); // deliberately ceil the offset to avoid the underline coming too close to // the text above it. - const qreal aliasedCoordinateDelta = 0.5 - 0.015625; - const qreal underlinePos = pos.y() + qCeil(underlineOffset) - aliasedCoordinateDelta; + const qreal underlinePos = pos.y() + qCeil(underlineOffset); if (underlineStyle == QTextCharFormat::SpellCheckUnderline) { underlineStyle = QTextCharFormat::SpellCheckUnderline; // ### Qt5 QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle)); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index dbf1b457f6..d1f168805a 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -3046,7 +3046,7 @@ void QTextEngine::adjustUnderlines(ItemDecorationList::iterator start, { for (ItemDecorationList::iterator it = start; it != end; ++it) { it->y = underlinePos; - it->pen.setWidth(penWidth); + it->pen.setWidthF(penWidth); } } |