on 4e77f91 help sign in
unity8/qml/Dash/CardFilterGrid.qml
71 lines 2.9 kB history raw
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 */
17import QtQuick 2.0
18import "../Components"
20DashRenderer {
21 id: genericFilterGrid
23 expandable: filterGrid.expandable
24 collapsedHeight: filterGrid.collapsedHeight
25 uncollapsedHeight: filterGrid.uncollapsedHeight
26 originY: filterGrid.originY
27 height: filterGrid.height
28 filtered: filterGrid.filtered
30 function setFilter(filter, animate) {
31 filterGrid.setFilter(filter, animate)
32 }
34 FilterGrid {
35 id: filterGrid
36 width: genericFilterGrid.width
37 minimumHorizontalSpacing: units.gu(1)
38 delegateWidth: cardTool.cardWidth
39 delegateHeight: cardTool.cardHeight
40 verticalSpacing: units.gu(1)
41 model: genericFilterGrid.model
42 collapsedRowCount: Math.min(2, cardTool && cardTool.template && cardTool.template["collapsed-rows"] || 2)
43 displayMarginBeginning: genericFilterGrid.displayMarginBeginning
44 displayMarginEnd: genericFilterGrid.displayMarginEnd
45 delegate: Item {
46 width: filterGrid.cellWidth
47 height: filterGrid.cellHeight
48 Loader {
49 id: loader
50 sourceComponent: cardTool.cardComponent
51 anchors.horizontalCenter: parent.horizontalCenter
52 onLoaded: {
53 item.objectName = "delegate" + index;
54 item.width = Qt.binding(function() { return cardTool.cardWidth; });
55 item.height = Qt.binding(function() { return cardTool.cardHeight; });
56 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
57 item.cardData = Qt.binding(function() { return model; });
58 item.template = Qt.binding(function() { return cardTool.template; });
59 item.components = Qt.binding(function() { return cardTool.components; });
60 item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
61 item.scopeStyle = genericFilterGrid.scopeStyle;
62 }
63 Connections {
64 target: loader.item
65 onClicked: genericFilterGrid.clicked(index, result)
66 onPressAndHold: genericFilterGrid.pressAndHold(index)
67 }
68 }
69 }
70 }