From 4b2d017a4249cfc8dae17087129e5f9a9aedc331 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. Change-Id: I3ae9a2df0a160b50593931828cdd69c0a8d4b5c4 Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit 834617e1d048df53d4434362d2c18b962f51e176) Reviewed-by: Qt Cherry-pick Bot --- 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 486e04544af..eee86d9a6ff 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);