Unity 8
 All Classes Functions Properties
CardFilterGrid.qml
1 /*
2  * Copyright (C) 2013 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.0
18 import "../Components"
19 
20 DashRenderer {
21  id: genericFilterGrid
22 
23  expandable: filterGrid.expandable
24  collapsedHeight: filterGrid.collapsedHeight
25  margins: filterGrid.margins
26  uncollapsedHeight: filterGrid.uncollapsedHeight
27  originY: filterGrid.originY
28  verticalSpacing: units.gu(1)
29  currentItem: filterGrid.currentItem
30  height: filterGrid.height
31  filtered: filterGrid.filtered
32 
33  function setFilter(filter, animate) {
34  filterGrid.setFilter(filter, animate)
35  }
36 
37  FilterGrid {
38  id: filterGrid
39  width: genericFilterGrid.width
40  minimumHorizontalSpacing: units.gu(1)
41  delegateWidth: cardTool.cardWidth
42  delegateHeight: cardTool.cardHeight
43  verticalSpacing: genericFilterGrid.verticalSpacing
44  model: genericFilterGrid.model
45  collapsedRowCount: Math.min(2, cardTool && cardTool.template && cardTool.template["collapsed-rows"] || 2)
46  delegateCreationBegin: genericFilterGrid.delegateCreationBegin
47  delegateCreationEnd: genericFilterGrid.delegateCreationEnd
48  delegate: Item {
49  width: filterGrid.cellWidth
50  height: filterGrid.cellHeight
51  Loader {
52  id: loader
53  sourceComponent: cardTool.cardComponent
54  anchors.horizontalCenter: parent.horizontalCenter
55  onLoaded: {
56  item.objectName = "delegate" + index;
57  item.width = Qt.binding(function() { return cardTool.cardWidth; });
58  item.height = Qt.binding(function() { return cardTool.cardHeight; });
59  item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
60  item.cardData = Qt.binding(function() { return model; });
61  item.template = Qt.binding(function() { return cardTool.template; });
62  item.components = Qt.binding(function() { return cardTool.components; });
63  item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
64  }
65  Connections {
66  target: loader.item
67  onClicked: genericFilterGrid.clicked(index, item.y)
68  onPressAndHold: genericFilterGrid.pressAndHold(index, item.y)
69  }
70  }
71  }
72  }
73 }