summaryrefslogtreecommitdiff
path: root/src/controls
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2014-10-07 09:44:55 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2014-10-08 17:53:07 +0200
commite951744145bf4ad520f2cb7210df3f43f73d2ec5 (patch)
tree0c52c4867e19cac171a2cba6fb61af175d7b2b98 /src/controls
parenta3c4353e1b822e6829b5ce1f558ed5de4f4b438b (diff)
downloadqtquickcontrols-e951744145bf4ad520f2cb7210df3f43f73d2ec5.tar.gz
iOS style: enhance cursor delegate
This patch fixes two issues: 1. The cursor should not blink while the user is typing. So when the cursor position changes, we restart the timer. 2. There is no need for the timer to be active if the cursor is not visible. Change-Id: I01b194faf1f7fe9f9f9c6372bc611b4b45e61591 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/controls')
-rw-r--r--src/controls/Styles/iOS/CursorDelegate.qml18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/controls/Styles/iOS/CursorDelegate.qml b/src/controls/Styles/iOS/CursorDelegate.qml
index 48606ab3..fc2907de 100644
--- a/src/controls/Styles/iOS/CursorDelegate.qml
+++ b/src/controls/Styles/iOS/CursorDelegate.qml
@@ -41,15 +41,27 @@ import QtQuick 2.2
Rectangle {
id: cursor
+
+ property Item input: parent
+
width: 2
- height: parent.cursorRectangle.height
+ height: input.cursorRectangle.height
color: "#446cf2"
antialiasing: false
- visible: parent.activeFocus && parent.selectionStart === parent.selectionEnd
+ visible: input.activeFocus && input.selectionStart === input.selectionEnd
state: "on"
+ Connections {
+ target: input
+ onCursorPositionChanged: {
+ state = "on"
+ timer.restart()
+ }
+ }
+
Timer {
- running: true
+ id: timer
+ running: cursor.visible
repeat: true
interval: 500
onTriggered: cursor.state = cursor.state == "on" ? "off" : "on"