From a393d5e1a0ad7bb42d9ee0c1e43a2437a957c416 Mon Sep 17 00:00:00 2001 From: Michael Bohlender Date: Thu, 29 Jun 2017 17:17:43 +0200 Subject: fix autocompletelineedit delegate --- framework/qml/AutocompleteLineEdit.qml | 34 +++++++++++++++++++--------------- 1 file 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 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 as Controls2 import QtQuick.Layouts 1.1 +import QtQuick.Templates 2.1 as T + import org.kube.framework 1.0 as Kube @@ -109,31 +111,26 @@ Kube.TextField { interactive: true model: root.model //TODO abstract listItem - delegate: Rectangle { + delegate: T.ItemDelegate { id: listDelegate - property string text: model.text width: listView.width height: root.height + padding: Kube.Units.smallSpacing - //enabled: true - //supportsMouseEvents: true - - //checked: listView.currentIndex == index + text: model.text - MouseArea { - anchors.fill: parent + checked: listView.currentIndex == index - onClicked: { - listView.currentIndex = model.index - accept() - } + onClicked: { + listView.currentIndex = model.index + accept() } //Content - Item { - width: parent.width - height: parent.height + contentItem: Item { + width: parent.width - padding * 2 + height: parent.height - padding * 2 Column { anchors { @@ -153,6 +150,13 @@ Kube.TextField { } } } + + background: Rectangle { + color: listDelegate.checked ? Kube.Colors.highlightColor : Kube.Colors.viewBackgroundColor + + border.width: 1 + color: Kube.Colors.buttonColor + } } } } -- cgit v1.2.3