plaintextEdit draw text with clipRect should consider cusorWidth

If the width of the text to be drawn is equal to the width of
clipRect, the cursor will not be displayed.
So we need add cursorWidth to the clipRect when draw text.

Fixes: QTBUG-94028
Pick-to: 5.15
Change-Id: I8686953f13c04d224327cf0f865ded7241d80ccd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Zhang Hao 2021-11-05 16:02:33 +08:00
parent 09a68dfa94
commit 7451fb36fd

View File

@ -1942,7 +1942,7 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e)
// keep right margin clean from full-width selection
int maxX = offset.x() + qMax((qreal)viewportRect.width(), maximumWidth)
- document()->documentMargin();
- document()->documentMargin() + cursorWidth();
er.setRight(qMin(er.right(), maxX));
painter.setClipRect(er);