aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextinput_p_p.h
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2016-04-20 11:35:42 +0200
committerRichard Moe Gustavsen <richard.gustavsen@theqtcompany.com>2016-04-21 13:15:18 +0000
commitc598d52561e048319c6c3656bedf4bb665603dc7 (patch)
tree3f59da3e0aa75ef43591b5f42ba51037eedf8775 /src/quick/items/qquicktextinput_p_p.h
parent597370b36487d2d2ed438db531f2d4aad4e55744 (diff)
QQuickTextInput: Listen for changes to cursorFlashTime
cursorFlashTime will now change dynamically from QPA while platform controlled text selection (on mobile) is ongoing. This patch will therefore update QWidgetLineControl so that it listens to the cursorFlashTimeChanged signal and changes the blinking rate when triggered. The previous code had a function setCursorBlinkPeriod, which is now changed to setBlinkingCursorEnabled (like in QQuickTextControlPrivate). This is because all callers of the function did either pass "QApplication::cursorFlashTime" or "0", which basically means enable or disable blinking. This moves the control of the blinking rate fully to updateCursorFlashTime, which simplifies the code a bit, especially when cursorFlashTime can change. Note that when setting a blink period to 0, it means "show the cursor without blinking". AFAICS, the current implementation did not guarantee that. This is now made more explicit in the code. If hiding the cursor is needed, a separate function "setCursorVisible" is already available for controlling that. Change-Id: Ie3222525474e03b485ff8585fd8d7da6fd5b26e5 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'src/quick/items/qquicktextinput_p_p.h')
-rw-r--r--src/quick/items/qquicktextinput_p_p.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h
index 9d3c66f04a..57a9f6413a 100644
--- a/src/quick/items/qquicktextinput_p_p.h
+++ b/src/quick/items/qquicktextinput_p_p.h
@@ -107,7 +107,7 @@ public:
#ifndef QT_NO_IM
, m_preeditCursor(0)
#endif
- , m_blinkPeriod(0)
+ , m_blinkEnabled(false)
, m_blinkTimer(0)
, m_maxLength(32767)
, m_lastCursorPos(-1)
@@ -242,7 +242,7 @@ public:
#ifndef QT_NO_IM
int m_preeditCursor;
#endif
- int m_blinkPeriod; // 0 for non-blinking cursor
+ bool m_blinkEnabled;
int m_blinkTimer;
int m_maxLength;
int m_lastCursorPos;
@@ -307,8 +307,9 @@ public:
return !tripleClickTimer.hasExpired(QGuiApplication::styleHints()->mouseDoubleClickInterval());
}
- void setNativeCursorEnabled(bool enabled) {
- setCursorBlinkPeriod(enabled && cursorVisible ? QGuiApplication::styleHints()->cursorFlashTime() : 0); }
+ void setNativeCursorEnabled(bool) {
+ updateCursorBlinking();
+ }
int nextMaskBlank(int pos)
{
@@ -443,7 +444,8 @@ public:
#endif
void processKeyEvent(QKeyEvent* ev);
- void setCursorBlinkPeriod(int msec);
+ void setBlinkingCursorEnabled(bool enable);
+ void updateCursorBlinking();
void updateLayout();
void updateBaselineOffset();