diff options
-rw-r--r-- | framework/qml/AutocompleteLineEdit.qml | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/framework/qml/AutocompleteLineEdit.qml b/framework/qml/AutocompleteLineEdit.qml index c5f89450..165b7a14 100644 --- a/framework/qml/AutocompleteLineEdit.qml +++ b/framework/qml/AutocompleteLineEdit.qml | |||
@@ -19,6 +19,8 @@ | |||
19 | import QtQuick 2.7 | 19 | import QtQuick 2.7 |
20 | import QtQuick.Controls 2.0 as Controls2 | 20 | import QtQuick.Controls 2.0 as Controls2 |
21 | import QtQuick.Layouts 1.1 | 21 | import QtQuick.Layouts 1.1 |
22 | import QtQuick.Templates 2.1 as T | ||
23 | |||
22 | 24 | ||
23 | import org.kube.framework 1.0 as Kube | 25 | import org.kube.framework 1.0 as Kube |
24 | 26 | ||
@@ -109,31 +111,26 @@ Kube.TextField { | |||
109 | interactive: true | 111 | interactive: true |
110 | model: root.model | 112 | model: root.model |
111 | //TODO abstract listItem | 113 | //TODO abstract listItem |
112 | delegate: Rectangle { | 114 | delegate: T.ItemDelegate { |
113 | id: listDelegate | 115 | id: listDelegate |
114 | property string text: model.text | ||
115 | 116 | ||
116 | width: listView.width | 117 | width: listView.width |
117 | height: root.height | 118 | height: root.height |
119 | padding: Kube.Units.smallSpacing | ||
118 | 120 | ||
119 | //enabled: true | 121 | text: model.text |
120 | //supportsMouseEvents: true | ||
121 | |||
122 | //checked: listView.currentIndex == index | ||
123 | 122 | ||
124 | MouseArea { | 123 | checked: listView.currentIndex == index |
125 | anchors.fill: parent | ||
126 | 124 | ||
127 | onClicked: { | 125 | onClicked: { |
128 | listView.currentIndex = model.index | 126 | listView.currentIndex = model.index |
129 | accept() | 127 | accept() |
130 | } | ||
131 | } | 128 | } |
132 | 129 | ||
133 | //Content | 130 | //Content |
134 | Item { | 131 | contentItem: Item { |
135 | width: parent.width | 132 | width: parent.width - padding * 2 |
136 | height: parent.height | 133 | height: parent.height - padding * 2 |
137 | 134 | ||
138 | Column { | 135 | Column { |
139 | anchors { | 136 | anchors { |
@@ -153,6 +150,13 @@ Kube.TextField { | |||
153 | } | 150 | } |
154 | } | 151 | } |
155 | } | 152 | } |
153 | |||
154 | background: Rectangle { | ||
155 | color: listDelegate.checked ? Kube.Colors.highlightColor : Kube.Colors.viewBackgroundColor | ||
156 | |||
157 | border.width: 1 | ||
158 | color: Kube.Colors.buttonColor | ||
159 | } | ||
156 | } | 160 | } |
157 | } | 161 | } |
158 | } | 162 | } |