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 
21 DashRenderer {
22  id: root
23 
24  expandedHeight: cardTool.cardHeight + units.gu(2)
25  collapsedHeight: expandedHeight
26  clip: true
27 
28  ListView {
29  id: listView
30  anchors {
31  fill: parent
32  margins: units.gu(1)
33  rightMargin: 0
34  }
35  rightMargin: units.gu(1)
36  spacing: units.gu(1)
37  model: root.model
38  orientation: ListView.Horizontal
39 
40  delegate: Loader {
41  id: loader
42  sourceComponent: cardTool.cardComponent
43  anchors { top: parent.top; bottom: parent.bottom }
44  width: cardTool.cardWidth
45  onLoaded: {
46  item.objectName = "delegate" + index;
47  item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
48  item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
49  item.cardData = Qt.binding(function() { return model; });
50  item.template = Qt.binding(function() { return cardTool.template; });
51  item.components = Qt.binding(function() { return cardTool.components; });
52  item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
53  item.scopeStyle = root.scopeStyle;
54  }
55  Connections {
56  target: loader.item
57  onClicked: root.clicked(index, result, loader.item, model)
58  onPressAndHold: root.pressAndHold(index, result, model)
59  }
60  }
61  }
62 }