From 3cdc02d38274d42a0a25a50e3ed9de2c5ad264f0 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 29 Apr 2016 14:41:08 +0200 Subject: QWidgetTextControl: only show cursor when having focus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit d3dcc6f introduced a regression to QTextEdit, leaving it to always show the cursor regardless of focus. The reason is that QTextArea used to toggle visibilty by setting the cursor blink rate. What it really wanted to do was to set cursor visibility explicit. This patch implements function setCursorVisible, and updates the places that used to call setBlinkingCursorEnabled to instead call setCursorVisible (where it makes sense). Change-Id: I58ea965178d4faaf5b09f6f6a37a37d5e8b99c97 Reviewed-by: Jan Arve Sæther --- src/widgets/widgets/qwidgettextcontrol_p_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/widgets/widgets/qwidgettextcontrol_p_p.h') diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h index 16a3a153cc..e9b3589c5c 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h @@ -111,6 +111,7 @@ public: void _q_emitCursorPosChanged(const QTextCursor &someCursor); void _q_contentsChanged(int from, int charsRemoved, int charsAdded); + void setCursorVisible(bool visible); void setBlinkingCursorEnabled(bool enable); void updateCursorBlinking(); @@ -177,6 +178,7 @@ public: QTextDocument *doc; bool cursorOn; bool blinkingEnabled; + bool cursorVisible; QTextCursor cursor; bool cursorIsFocusIndicator; QTextCharFormat lastCharFormat; -- cgit v1.2.3