Debian Codegraph @

tests/resources/popover/PopoverTest.qml

raw
1 /*
2 * Copyright 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 Lesser 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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser 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 Lomiri.Components 1.1
19 import Lomiri.Components.Popups 1.0
20 import Lomiri.Components.ListItems 1.0 as ListItem
21
22 MainView {
23 width: units.gu(80)
24 height: units.gu(34)
25
26 Component {
27 id: popover
28
29 Popover {
30 Column {
31 anchors {
32 left: parent.left
33 top: parent.top
34 right: parent.right
35 }
36 ListItem.Standard { text: "Do something" }
37 ListItem.Standard { text: "Do something else" }
38 ListItem.Subtitled { text: "Title"; subText: "Subtitle"; showDivider: false}
39 }
40 }
41 }
42
43 Button {
44 id: referenceButton
45 visible: false
46 }
47
48 Grid {
49 id: grid
50 anchors.fill: parent
51 columns: 6
52 rows: 8
53 spacing: units.gu(6)
54 anchors.leftMargin: -referenceButton.width/2.0
55 anchors.topMargin: -referenceButton.height/2.0
56
57 Repeater {
58 model: grid.columns * grid.rows
59 delegate: Button {
60 id: button
61 text: "open"
62 onClicked: PopupUtils.open(popover, button)
63 }
64 }
65 }
66 }