summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorZhang Hao <zhanghao@uniontech.com>2021-11-05 16:02:33 +0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-05 16:16:30 +0000
commit3cbb190c5586001756fe69637db0e584575d279f (patch)
treedfe6bd21eea0c1429c4fe235b84c3d758408444b /src/widgets/widgets
parentde0c009f180e3026356be6c08d186d4168d1b641 (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 Change-Id: I8686953f13c04d224327cf0f865ded7241d80ccd Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 7451fb36fd1de38868c6c9a48da0b1b66a771672) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
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 97e6ccef36..3d5f155286 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);