From 834617e1d048df53d4434362d2c18b962f51e176 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 19 Mar 2023 15:07:48 +0100 Subject: [PATCH] QTextLayout/text cursor: use the same height as the selection The height of the selection was adjusted for high-dpi screens by a fix for QTBUG-98372. But the height of the cursor was forgotten. This is only visible with a very high device pixel ratio. Pick-to: 6.5 Change-Id: I3ae9a2df0a160b50593931828cdd69c0a8d4b5c4 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 486e04544a..eee86d9a6f 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1364,7 +1364,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition pen.setCosmetic(true); const qreal center = x + qreal(width) / 2; p->setPen(pen); - p->drawLine(QPointF(center, y), QPointF(center, y + (base + descent).toReal())); + p->drawLine(QPointF(center, y), QPointF(center, qCeil(y + (base + descent).toReal()))); p->setPen(origPen); } p->setCompositionMode(origCompositionMode);