summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qwidgettextcontrol.cpp
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2016-05-09 12:36:37 +0200
committerRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2016-05-09 11:38:44 +0000
commitc906d7abb84e60d2d4b66edce712cb32b3ce4470 (patch)
tree14a24b7ac92443946d7aa5d96083dd0c57c80db5 /src/widgets/widgets/qwidgettextcontrol.cpp
parentf643f6504bf2233c7a5c937be620daf944bb0f61 (diff)
QWidgetTextControl: ensure we listen for changes to cursorFlashTimeChanged
Change 3cdc02d actually "reverted" the behavior of listening for cursorFlashTimeChanged. The reason is that we sat "blinkingEnabled" directly to true in the constructor instead of calling "setCursorBlinking", which was responsible for setting up the connection. And as it turns out, after 3cdc02d, nobody is actually calling "setBlinkingCursorEnabled" anymore. From the widgets point of view, it should always blink when visible (unless QPA sets cursorFlashTime to zero). So we can remove the whole function, and set up the connection in "setVisible" instead. Change-Id: I577a5fbbbd9c56331ac7f8bb38567a684ca8c1df Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'src/widgets/widgets/qwidgettextcontrol.cpp')
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 52eb4e4078..77b5a4830b 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -112,7 +112,7 @@ static QTextLine currentTextLine(const QTextCursor &cursor)
}
QWidgetTextControlPrivate::QWidgetTextControlPrivate()
- : doc(0), cursorOn(false), blinkingEnabled(true), cursorVisible(false), cursorIsFocusIndicator(false),
+ : doc(0), cursorOn(false), cursorVisible(false), cursorIsFocusIndicator(false),
#ifndef Q_OS_ANDROID
interactionFlags(Qt::TextEditorInteraction),
#else
@@ -691,29 +691,18 @@ void QWidgetTextControlPrivate::setCursorVisible(bool visible)
return;
cursorVisible = visible;
-
updateCursorBlinking();
-}
-
-void QWidgetTextControlPrivate::setBlinkingCursorEnabled(bool enable)
-{
- if (blinkingEnabled == enable)
- return;
-
- blinkingEnabled = enable;
- if (enable)
+ if (cursorVisible)
connect(qApp->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetTextControlPrivate::updateCursorBlinking);
else
disconnect(qApp->styleHints(), &QStyleHints::cursorFlashTimeChanged, this, &QWidgetTextControlPrivate::updateCursorBlinking);
-
- updateCursorBlinking();
}
void QWidgetTextControlPrivate::updateCursorBlinking()
{
cursorBlinkTimer.stop();
- if (cursorVisible && blinkingEnabled) {
+ if (cursorVisible) {
int flashTime = QGuiApplication::styleHints()->cursorFlashTime();
if (flashTime >= 2)
cursorBlinkTimer.start(flashTime / 2, q_func());