summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2015-02-25 12:54:15 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2015-02-25 14:41:37 +0000
commit1cf99d7cfeb5e446c22e52974ce6402e04a02d01 (patch)
treeb82a57bfd3a76cd6505c617f2a76a1bdcb39f122 /src/gui/painting
parentbf16940d33208409d17b76bceb6d27b77675bea6 (diff)
Fix underline for centered text
The position of the text itself is always floored, since the glyph contains the subpixel antialiasing. Since no antialiasing is applied to the underline, its position also has to be floored, otherwise it will sometimes appear one pixel to the right of the text it's underlining. [ChangeLog][Text] Fixed position of underline on centered text when the text layout's width is an even number. Task-number: QTBUG-39286 Change-Id: Ib1704ac5b09289f5b3f5a6580443f234d6d868fc Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qpainter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 01f9904798..bdbb49ff51 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -6215,7 +6215,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
pen.setWidthF(fe->lineThickness().toReal());
pen.setCapStyle(Qt::FlatCap);
- QLineF line(pos.x(), pos.y(), pos.x() + width, pos.y());
+ QLineF line(qFloor(pos.x()), pos.y(), qFloor(pos.x() + width), pos.y());
bool wasCompatiblePainting = painter->renderHints()
& QPainter::Qt4CompatiblePainting;