on 262fb79 help sign in
106 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 ListViewWithPageHeader 0.1
20Rectangle {
21 width: 300
22 height: 542
23 color: "lightblue"
25 ListModel {
26 id: model
28 function insertItem(index, size, type) {
29 insert(index, { size: size, type: type });
30 }
32 function removeItems(index, count) {
33 remove(index, count);
34 }
36 function moveItems(indexFrom, indexTo, count) {
37 move(indexFrom, indexTo, count);
38 }
40 ListElement { type: "Agressive"; size: 150 }
41 ListElement { type: "Regular"; size: 200 }
42 ListElement { type: "Mild"; size: 350 }
43 ListElement { type: "Bold"; size: 350 }
44 ListElement { type: "Bold"; size: 350 }
45 ListElement { type: "Lazy"; size: 350 }
46 }
48 Component {
49 id: otherRect
50 Rectangle {
51 height: 35
52 width: parent.width
53 color: index % 2 == 0 ? "yellow" : "purple"
54 }
55 }
57 ListViewWithPageHeader {
58 id: listView
59 width: parent.width
60 anchors.top: parent.top
61 anchors.bottom: parent.bottom
62 model: model
63 delegate: Rectangle {
64 property bool timerDone: false
65 width: parent.width - 20
66 x: 10
67 color: index % 2 == 0 ? "red" : "blue"
68 height: timerDone ? size : 350
69 Text {
70 text: index
71 }
72 Timer {
73 id: sizeTimer
74 interval: 10;
75 onTriggered: {
76 timerDone = true
77 }
78 }
79 Component.onCompleted: {
80 sizeTimer.start()
81 }
82 }
84 pageHeader: Rectangle {
85 color: "transparent"
86 width: parent.width
87 height: 50
88 implicitHeight: 50
89 Text {
90 anchors.fill: parent
91 text: "APPS"
92 font.pixelSize: 40
93 }
94 }
96 sectionProperty: "type"
97 sectionDelegate: Component {
98 Rectangle {
99 color: "green"
100 height: 40
101 Text { text: section; font.pixelSize: 34 }
102 anchors { left: parent.left; right: parent.right }
103 }
104 }
105 }