aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material/SpinBox.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-04-20 18:05:03 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-04-20 18:05:03 +0000
commit692f49e85f3b3b38ba4cb8835b6e505b9648b07f (patch)
tree7c96c6e38d69557be4efc1f78df3e0ec7cb0e2bf /src/imports/controls/material/SpinBox.qml
parentf6a782d398abb60f5f6bcad14d5c2228bc0c436f (diff)
parente8cd9c045840b4a9db4e20aaaa16ea6f841ed1c1 (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'src/imports/controls/material/SpinBox.qml')
-rw-r--r--src/imports/controls/material/SpinBox.qml25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/imports/controls/material/SpinBox.qml b/src/imports/controls/material/SpinBox.qml
index 57b4b3b8..e34d7943 100644
--- a/src/imports/controls/material/SpinBox.qml
+++ b/src/imports/controls/material/SpinBox.qml
@@ -77,6 +77,31 @@ T.SpinBox {
selectedTextColor: control.Material.primaryTextColor
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
+ cursorDelegate: Rectangle {
+ id: cursor
+ color: control.Material.accentColor
+ width: 2
+ visible: control.activeFocus && contentItem.selectionStart === contentItem.selectionEnd
+
+ Connections {
+ target: contentItem
+ onCursorPositionChanged: {
+ // keep a moving cursor visible
+ cursor.opacity = 1
+ timer.restart()
+ }
+ }
+
+ Timer {
+ id: timer
+ running: control.activeFocus
+ repeat: true
+ interval: Qt.styleHints.cursorFlashTime
+ onTriggered: cursor.opacity = !cursor.opacity ? 1 : 0
+ // force the cursor visible when gaining focus
+ onRunningChanged: cursor.opacity = 1
+ }
+ }
readOnly: !control.editable
validator: control.validator