From 0613bf5d160e79476435da54f2cad2676de4a558 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 26 Mar 2020 17:30:47 +0100 Subject: QTextEdit: remove the cursor when a read-only textedit looses focus A read-only text edit with Qt::TextSelectableByKeyboard shows a steady cursor to indicate to users that they can select the text, but not edit it. When the control receives focus, it doesn't turn on blinking, but explicitly sets cursorOn to true. When focus is lost, then cursorOn needs to be reset to false to make the cursor disappear, even if the blinking (as indicated by the poorly named cursorVisible variable) is not on. Change-Id: I78408b5c50c6ede3f9a7128be7a31b9c6795cf9c Fixes: QTBUG-83029 Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qwidgettextcontrol.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/widgets/widgets/qwidgettextcontrol.cpp') diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 45ab384036..2e302e3d9c 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -2236,6 +2236,7 @@ void QWidgetTextControlPrivate::focusEvent(QFocusEvent *e) #endif } else { setCursorVisible(false); + cursorOn = false; if (cursorIsFocusIndicator && e->reason() != Qt::ActiveWindowFocusReason -- cgit v1.2.3