From 7451fb36fd1de38868c6c9a48da0b1b66a771672 Mon Sep 17 00:00:00 2001 From: Zhang Hao Date: Fri, 5 Nov 2021 16:02:33 +0800 Subject: [PATCH] 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 --- src/widgets/widgets/qplaintextedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index aedd4593ec1..daa81512e23 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -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);