on 262fb79 help sign in
unity8/tests/plugins/ListViewWithPageHeader/test_sectionexternalmodel.qml
74 lines 2.1 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 ListViewWithPageHeader {
26 id: listView
27 width: parent.width
28 anchors.top: parent.top
29 anchors.bottom: parent.bottom
30 model: model
31 delegate: Rectangle {
32 property bool timerDone: false
33 width: parent.width - 20
34 x: 10
35 color: index % 2 == 0 ? "red" : "blue"
36 height: timerDone ? size : 350
37 Text {
38 text: index
39 }
40 Timer {
41 id: sizeTimer
42 interval: 10;
43 onTriggered: {
44 timerDone = true
45 }
46 }
47 Component.onCompleted: {
48 sizeTimer.start()
49 }
50 }
52 pageHeader: Rectangle {
53 color: "transparent"
54 width: parent.width
55 height: 50
56 implicitHeight: 50
57 Text {
58 anchors.fill: parent
59 text: "APPS"
60 font.pixelSize: 40
61 }
62 }
64 sectionProperty: "type"
65 sectionDelegate: Component {
66 Rectangle {
67 color: "green"
68 height: 40
69 Text { text: section; font.pixelSize: 34 }
70 anchors { left: parent.left; right: parent.right }
71 }
72 }
73 }