summaryrefslogtreecommitdiffstats
path: root/components/package/contents/ui/AutocompleteLineEdit.qml
diff options
context:
space:
mode:
authorMichael Bohlender <michael.bohlender@kdemail.net>2016-12-06 17:11:43 +0100
committerMichael Bohlender <michael.bohlender@kdemail.net>2016-12-06 17:11:43 +0100
commita878d3cfe1a9ade1f4bee939053c5cee257f64eb (patch)
treec46619ff32e3132216e56ab37ab30f3f2ca6ce6d /components/package/contents/ui/AutocompleteLineEdit.qml
parent0e806bca0ac93f365b9edd687620dd033376115e (diff)
downloadkube-a878d3cfe1a9ade1f4bee939053c5cee257f64eb.tar.gz
kube-a878d3cfe1a9ade1f4bee939053c5cee257f64eb.zip
port autocompletelineedit to qqc2
Diffstat (limited to 'components/package/contents/ui/AutocompleteLineEdit.qml')
-rw-r--r--components/package/contents/ui/AutocompleteLineEdit.qml104
1 files changed, 49 insertions, 55 deletions
diff --git a/components/package/contents/ui/AutocompleteLineEdit.qml b/components/package/contents/ui/AutocompleteLineEdit.qml
index cb6e4fcb..a24ed0ee 100644
--- a/components/package/contents/ui/AutocompleteLineEdit.qml
+++ b/components/package/contents/ui/AutocompleteLineEdit.qml
@@ -1,26 +1,24 @@
1/* 1/*
2 Copyright (C) 2016 Christian Mollekopf, <mollekopf@kolabsys.com> 2 * Copyright (C) 2016 Christian Mollekopf, <mollekopf@kolabsys.com>
3 3 *
4 This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or 6 * the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version. 7 * (at your option) any later version.
8 8 *
9 This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details. 12 * GNU General Public License for more details.
13 13 *
14 You should have received a copy of the GNU General Public License along 14 * You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc., 15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17*/ 17 */
18 18
19import QtQuick 2.7 19import QtQuick 2.7
20import QtQuick.Controls 1.4 as Controls1
21import QtQuick.Controls 2.0 as Controls2 20import QtQuick.Controls 2.0 as Controls2
22import QtQuick.Layouts 1.1 21import QtQuick.Layouts 1.1
23import QtQuick.Dialogs 1.0
24 22
25import org.kde.kirigami 1.0 as Kirigami 23import org.kde.kirigami 1.0 as Kirigami
26 24
@@ -94,46 +92,42 @@ Controls2.TextField {
94 width: textField.width 92 width: textField.width
95 border.color: "Black" 93 border.color: "Black"
96 radius: 5 94 radius: 5
97 Controls1.ScrollView { 95 ListView {
98 id: scrollView 96 id: listView
99 anchors.fill: parent 97 height: childrenRect.height
100 ListView { 98 width: parent.width
101 id: listView 99 interactive: true
102 height: childrenRect.height 100 model: textField.model
103 width: scrollView.width 101 delegate: Kirigami.AbstractListItem {
104 interactive: true 102 id: listDelegate
105 model: textField.model 103 property string text: model.text
106 delegate: Kirigami.AbstractListItem { 104
107 id: listDelegate 105 width: listView.width
108 property string text: model.text 106 height: textField.height
109 107
110 width: listView.width 108 enabled: true
111 height: textField.height 109 supportsMouseEvents: true
112 110
113 enabled: true 111 checked: listView.currentIndex == index
114 supportsMouseEvents: true 112 onClicked: {
115 113 listView.currentIndex = model.index
116 checked: listView.currentIndex == index 114 accept()
117 onClicked: { 115 }
118 listView.currentIndex = model.index
119 accept()
120 }
121 116
122 //Content 117 //Content
123 Item { 118 Item {
124 width: parent.width 119 width: parent.width
125 height: parent.height 120 height: parent.height
126 121
127 Column { 122 Column {
128 anchors { 123 anchors {
129 verticalCenter: parent.verticalCenter 124 verticalCenter: parent.verticalCenter
130 left: parent.left 125 left: parent.left
131 } 126 }
132 127
133 Text{ 128 Text{
134 text: model.text 129 text: model.text
135 color: listDelegate.checked ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor 130 color: listDelegate.checked ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
136 }
137 } 131 }
138 } 132 }
139 } 133 }