diff options
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 604c1ab..754b16e 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -6335,10 +6335,16 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QLineF line(pos.x(), pos.y(), pos.x() + width, pos.y()); - const qreal underlineOffset = fe->underlinePosition().toReal(); + qreal underlineOffset = fe->underlinePosition().toReal(); + qreal y = pos.y(); + // compensate for different rounding rule in Core Graphics paint engine, + // ideally code like this should be moved to respective engines. + if (painter->paintEngine()->type() == QPaintEngine::CoreGraphics) { + y = qCeil(y); + } // deliberately ceil the offset to avoid the underline coming too close to // the text above it. - const qreal underlinePos = pos.y() + qCeil(underlineOffset); + const qreal underlinePos = y + qCeil(underlineOffset); if (underlineStyle == QTextCharFormat::SpellCheckUnderline) { underlineStyle = QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle)); |