diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-25 05:06:44 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-07-25 05:06:44 +0200 |
commit | a7163fd03a98d164ee572d187771be9d78ad44a9 (patch) | |
tree | 23d83745f843c5e2122c83ec1ddfeba92bfb529c /framework/qml/ListDelegate.qml | |
parent | b1e49b5bad02f6dbab9578d2cdd0ad73b18e1c4a (diff) | |
download | kube-a7163fd03a98d164ee572d187771be9d78ad44a9.tar.gz kube-a7163fd03a98d164ee572d187771be9d78ad44a9.zip |
Use the ListDelegate
Diffstat (limited to 'framework/qml/ListDelegate.qml')
-rw-r--r-- | framework/qml/ListDelegate.qml | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/framework/qml/ListDelegate.qml b/framework/qml/ListDelegate.qml index 3c63ccbe..002027d6 100644 --- a/framework/qml/ListDelegate.qml +++ b/framework/qml/ListDelegate.qml | |||
@@ -19,23 +19,34 @@ | |||
19 | 19 | ||
20 | import QtQuick 2.7 | 20 | import QtQuick 2.7 |
21 | import org.kube.framework 1.0 as Kube | 21 | import org.kube.framework 1.0 as Kube |
22 | import QtQuick.Templates 2.0 as T | ||
22 | 23 | ||
23 | Rectangle { | 24 | T.ItemDelegate { |
24 | id: root | 25 | id: root |
25 | property variant currentData: model | 26 | property variant currentData: model |
26 | property var listView: root.parent | 27 | property alias color: background.color |
27 | default property alias contentItem: root.children | 28 | property alias border: background.border |
28 | 29 | ||
29 | height: Kube.Units.gridUnit * 3 | 30 | height: Kube.Units.gridUnit * 3 |
30 | width: listView.width | 31 | width: root.ListView.view.width |
32 | hoverEnabled: true | ||
31 | 33 | ||
32 | border.color: Kube.Colors.buttonColor | 34 | background: Rectangle { |
33 | border.width: 1 | 35 | id: background |
34 | color: listView.currentIndex == root.index ? Kube.Colors.highlightColor : Kube.Colors.viewBackgroundColor | 36 | border.color: Kube.Colors.buttonColor |
35 | 37 | border.width: 1 | |
36 | MouseArea { | 38 | color: Kube.Colors.viewBackgroundColor |
37 | id: mouseArea | 39 | Rectangle { |
38 | anchors.fill: parent | 40 | anchors.fill: parent |
39 | onClicked: listView.currentIndex = root.index | 41 | visible: root.ListView.isCurrentItem |
42 | color: Kube.Colors.highlightColor | ||
43 | } | ||
44 | Rectangle { | ||
45 | anchors.fill: parent | ||
46 | visible: root.hovered || root.activeFocus | ||
47 | border.color: Kube.Colors.focusedButtonColor | ||
48 | border.width: 2 | ||
49 | color: "transparent" | ||
50 | } | ||
40 | } | 51 | } |
41 | } | 52 | } |