Debian Codegraph @

tests/resources/buttons/ComboTest.qml

raw
1 /*
2 * Copyright 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 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 * Author: Zsombor Egri <[email protected]>
17 */
18 import QtQuick 2.0
19 import Lomiri.Components 1.1
20 import Lomiri.Components.ListItems 1.0
21
22 MainView {
23 width: units.gu(40)
24 height: units.gu(71)
25
26
27 Column {
28 anchors.fill: parent
29 spacing: units.gu(2)
30
31 ComboButton {
32 id: combo1
33 text: "collapsedHeight differs"
34 collapsedHeight: units.gu(6)
35 }
36
37 ComboButton {
38 text: "content is Rectangle > expanded"
39 Rectangle {
40 height: units.gu(40)
41 gradient: Gradient {
42 GradientStop {
43 position: 0.0
44 color: "red"
45 }
46 GradientStop {
47 position: 0.5
48 color: "green"
49 }
50 GradientStop {
51 position: 1.0
52 color: "blue"
53 }
54 }
55 }
56 }
57
58 ComboButton {
59 text: "comboList is Flickable"
60 Flickable {
61 id: flickable
62 objectName: "Flickable"
63 anchors {
64 left: parent.left
65 right: parent.right
66 top: parent.top
67 }
68 contentHeight: rect.height
69
70 Rectangle {
71 id: rect
72 width: parent.width
73 height: units.gu(40)
74 gradient: Gradient {
75 GradientStop {
76 position: 0.0
77 color: "red"
78 }
79 GradientStop {
80 position: 0.5
81 color: "green"
82 }
83 GradientStop {
84 position: 1.0
85 color: "blue"
86 }
87 }
88 }
89 }
90 }
91
92 ComboButton {
93 id: combo2
94 text: "comboList is ListView"
95 expanded: true
96 expandedHeight: units.gu(30)
97 LomiriListView {
98 objectName: "ListView"
99 model: 20
100 delegate: Standard {
101 text: "Action #" + modelData
102 onClicked: {
103 combo2.text = text;
104 combo2.expanded = false
105 }
106 }
107 }
108 }
109
110 ComboButton {
111 id: combo3
112 text: "auto expandHeight"
113 expandedHeight: -1
114 Column {
115 id: column
116 anchors {
117 left: parent.left
118 right: parent.right
119 }
120 Rectangle {
121 width: parent.width
122 height: units.gu(6)
123 color: "red"
124 }
125 Rectangle {
126 width: parent.width
127 height: units.gu(6)
128 color: "green"
129 }
130 Rectangle {
131 width: parent.width
132 height: units.gu(6)
133 color: "blue"
134 }
135 Rectangle {
136 width: parent.width
137 height: units.gu(6)
138 color: "yellow"
139 }
140 }
141 }
142 }
143 }