aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material/TextArea.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-10-27 16:44:50 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-10-28 08:48:43 +0000
commit84cd2f6b30ac107c0daa9ec37b114eb1a94323a5 (patch)
tree588917489cd39ccfcaf722e8319bb3aef07b4d11 /src/imports/controls/material/TextArea.qml
parent0babb4de001be4aa75d9ea0bfbab869a1c2b27c7 (diff)
Material: share the CursorDelegate
Duplicate code in TextField, TextArea, and SpinBox. The next one is editable ComboBox. Change-Id: Ibbd054d2f945f4964ee0007f9e9dc8a9450902e9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/material/TextArea.qml')
-rw-r--r--src/imports/controls/material/TextArea.qml27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/imports/controls/material/TextArea.qml b/src/imports/controls/material/TextArea.qml
index 8fdead60..9018df2e 100644
--- a/src/imports/controls/material/TextArea.qml
+++ b/src/imports/controls/material/TextArea.qml
@@ -37,6 +37,7 @@
import QtQuick 2.8
import QtQuick.Templates 2.1 as T
import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.TextArea {
id: control
@@ -54,32 +55,8 @@ T.TextArea {
color: enabled ? Material.primaryTextColor : Material.hintTextColor
selectionColor: Material.accentColor
selectedTextColor: Material.primaryHighlightedTextColor
- cursorDelegate: Rectangle {
- id: cursor
- clip: true // TODO
- 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 {
- id: timer
- running: control.activeFocus
- repeat: true
- interval: Qt.styleHints.cursorFlashTime / 2
- onTriggered: cursor.opacity = !cursor.opacity ? 1 : 0
- // force the cursor visible when gaining focus
- onRunningChanged: cursor.opacity = 1
- }
- }
+ cursorDelegate: CursorDelegate { }
Text {
id: placeholder