summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorZhang Hao <zhanghao@uniontech.com>2021-11-05 16:02:33 +0800
committerZhang Hao <zhanghao@uniontech.com>2021-11-05 15:31:23 +0000
commit7451fb36fd1de38868c6c9a48da0b1b66a771672 (patch)
tree74b9424da9c011ddc58e9e99785d7b34287788c1 /src/widgets/widgets
parent09a68dfa94e9d5eb8c59d7008a4169cf0e33b306 (diff)
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>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index aedd4593ec..daa81512e2 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);