on ac4b821 help sign in
unity8/tests/plugins/DashViews/organicgridtry.qml
94 lines 2.5 kB history raw
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 */
17import QtQuick 2.1
18import DashViews 0.1
20Item {
21 id: root
22 signal add()
23 signal remove()
25 ListViewWithPageHeader {
26 id: lvwph
27 model: listModel
28 height: parent.height
29 width: parent.width - controls.width
31 delegate: OrganicGrid {
32 id: grid
33 model: gridModel
34 smallDelegateSize: Qt.size(90, 90)
35 bigDelegateSize: Qt.size(180, 180)
36 columnSpacing: 10
37 rowSpacing: 10
38 width: parent.width
39 height: implicitHeight > 100 ? implicitHeight : 100
40 delegateCreationBegin: lvwph.contentY
41 delegateCreationEnd: lvwph.contentY + lvwph.height
43 delegate: Rectangle {
44 width: 100
45 color: "red";
46 border.width: 3
48 Text {
49 text: index
50 x: 10
51 y: 10
52 }
53 }
54 }
55 }
57 Rectangle {
58 id: controls
59 height: parent.height
60 width: 100
61 anchors.right: parent.right
62 color: "gray"
63 opacity: 0.4
65 Rectangle {
66 id: addButton
67 height: 50
68 width: parent.width
69 color: "blue"
70 Text {
71 text: "Add"
72 anchors.centerIn: parent
73 }
74 MouseArea {
75 anchors.fill: parent
76 onClicked: root.add()
77 }
78 }
79 Rectangle {
80 anchors.top: addButton.bottom
81 height: 50
82 width: parent.width
83 color: "red"
84 Text {
85 text: "Remove"
86 anchors.centerIn: parent
87 }
88 MouseArea {
89 anchors.fill: parent
90 onClicked: root.remove()
91 }
92 }
93 }