diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-04-20 16:06:15 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-04-20 16:23:33 +0200 |
commit | e8cd9c045840b4a9db4e20aaaa16ea6f841ed1c1 (patch) | |
tree | fc23ddbab837a5d4ae5da00c4a7ebd0ac31e4be8 /src/imports/controls/material/SpinBox.qml | |
parent | b772b5e349c48260a1c0458f841b2e6e82daf0b1 (diff) | |
parent | 1cb0faf7886d9df99adfb61560e369387691f89c (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ia8879787703c32db44119b25be10adc83adc40bb
Diffstat (limited to 'src/imports/controls/material/SpinBox.qml')
-rw-r--r-- | src/imports/controls/material/SpinBox.qml | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/imports/controls/material/SpinBox.qml b/src/imports/controls/material/SpinBox.qml index f8fc84c8..1851a1f8 100644 --- a/src/imports/controls/material/SpinBox.qml +++ b/src/imports/controls/material/SpinBox.qml @@ -74,6 +74,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 |