From 072f3841023c24576802861847befda9182d81d7 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 2 Jul 2018 11:50:38 +0200 Subject: Prettify the autocomplete list by using the standard delegate --- framework/qml/AutocompleteLineEdit.qml | 35 +++++----------------------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/framework/qml/AutocompleteLineEdit.qml b/framework/qml/AutocompleteLineEdit.qml index 1be8f7eb..e5368fe9 100644 --- a/framework/qml/AutocompleteLineEdit.qml +++ b/framework/qml/AutocompleteLineEdit.qml @@ -125,53 +125,28 @@ Kube.TextField { width: parent.width interactive: true model: root.model - //TODO abstract listItem - delegate: T.ItemDelegate { + delegate: Kube.ListDelegate { id: listDelegate - width: listView.width height: root.height padding: Kube.Units.smallSpacing text: model.text - checked: listView.currentIndex == index - - onClicked: { - listView.currentIndex = model.index - accept() - } - - //Content contentItem: Item { width: parent.width - padding * 2 height: parent.height - padding * 2 - - Column { + Kube.Label{ anchors { verticalCenter: parent.verticalCenter left: parent.left right: parent.right } - - Kube.Label{ - anchors { - left: parent.left - right: parent.right - } - text: model.text - color: listDelegate.checked ? Kube.Colors.highlightedTextColor : Kube.Colors.textColor - elide: Text.ElideRight - } + text: model.text + color: listDelegate.textColor + elide: Text.ElideRight } } - - background: Rectangle { - color: listDelegate.checked ? Kube.Colors.highlightColor : Kube.Colors.viewBackgroundColor - - border.width: 1 - border.color: Kube.Colors.buttonColor - } } } } -- cgit v1.2.3