aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material/TextArea.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/controls/material/TextArea.qml')
-rw-r--r--src/imports/controls/material/TextArea.qml26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/imports/controls/material/TextArea.qml b/src/imports/controls/material/TextArea.qml
index 4f5c7491..a5423727 100644
--- a/src/imports/controls/material/TextArea.qml
+++ b/src/imports/controls/material/TextArea.qml
@@ -51,17 +51,31 @@ T.TextArea {
padding: 6
color: enabled ? Material.primaryTextColor : Material.hintTextColor
-// selectionColor: Theme.selectionColor
-// selectedTextColor: Theme.selectedTextColor
+ selectionColor: Material.accentColor
+ selectedTextColor: Material.primaryHighlightedTextColor
cursorDelegate: Rectangle {
+ id: cursor
color: control.Material.accentColor
width: 2
+ visible: control.activeFocus && control.selectionStart === control.selectionEnd
+
+ Connections {
+ target: control
+ onCursorPositionChanged: {
+ // keep a moving cursor visible
+ cursor.opacity = 1
+ timer.restart()
+ }
+ }
Timer {
- running: true
+ id: timer
+ running: control.activeFocus
repeat: true
- interval: 500
- onTriggered: parent.visible = !parent.visible
+ interval: Qt.styleHints.cursorFlashTime
+ onTriggered: cursor.opacity = !cursor.opacity ? 1 : 0
+ // force the cursor visible when gaining focus
+ onRunningChanged: cursor.opacity = 1
}
}
@@ -84,7 +98,7 @@ T.TextArea {
//! [background]
background: Rectangle {
- y: control.y + control.height - height
+ y: control.height - height
implicitWidth: 120
height: control.activeFocus ? 2 : 1
color: control.activeFocus ? control.Material.accentColor : control.Material.hintTextColor