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 <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 834617e1d048df53d4434362d2c18b962f51e176)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2023-03-19 15:07:48 +01:00 committed by Qt Cherry-pick Bot
parent 78d6f6f57d
commit 4b2d017a42

View File

@ -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);