Unity 8
 All Classes Functions
CardHorizontalList.qml
1 /*
2  * Copyright (C) 2014 Canonical, Ltd.
3  *
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
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 import QtQuick 2.2
18 import Ubuntu.Components 1.1
19 import "../Components"
20 import "../Components/Flickables" as Flickables
21 
22 DashRenderer {
23  id: root
24 
25  expandedHeight: cardTool.cardHeight + units.gu(2)
26  collapsedHeight: expandedHeight
27  clip: true
28 
29  Flickables.ListView {
30  id: listView
31  anchors {
32  fill: parent
33  margins: units.gu(1)
34  rightMargin: 0
35  }
36  rightMargin: units.gu(1)
37  spacing: units.gu(1)
38  model: root.model
39  orientation: ListView.Horizontal
40 
41  delegate: Loader {
42  id: loader
43  sourceComponent: cardTool.cardComponent
44  anchors { top: parent.top; bottom: parent.bottom }
45  width: cardTool.cardWidth
46  onLoaded: {
47  item.objectName = "delegate" + index;
48  item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
49  item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
50  item.cardData = Qt.binding(function() { return model; });
51  item.template = Qt.binding(function() { return cardTool.template; });
52  item.components = Qt.binding(function() { return cardTool.components; });
53  item.titleAlignment = Qt.binding(function() { return cardTool.titleAlignment; });
54  item.scopeStyle = root.scopeStyle;
55  }
56  Connections {
57  target: loader.item
58  onClicked: root.clicked(index, result, loader.item, model)
59  onPressAndHold: root.pressAndHold(index, result, model)
60  }
61  }
62  }
63 }