2
* Copyright 2015 Canonical Ltd.
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.
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.
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/>.
18
import QtQuick.Layouts 1.1
19
import Ubuntu.Components 1.3
30
property list<Action> contextualActions: [
38
iconName: "stock_website"
48
onEnabledChanged: print("enabled", enabled)
50
height: parent.height / 2
52
ViewItems.onExpandedIndicesChanged: print(ViewItems.expandedIndices)
53
ViewItems.expansionFlags: ViewItems.CollapseOnOutsidePress
56
Component.onCompleted: {
57
for (var i = 0; i < 3; i++) {
58
append({label: "List item #"+i, sectionData: "Locked"});
60
for (i = 3; i < 11; i++) {
61
append({label: "List item #"+i, sectionData: "Limited, live move"});
63
for (i = 11; i < 25; i++) {
64
append({label: "List item #"+i, sectionData: "Unlimited, drag'n'drop"});
71
objectName: "ListItem-" + index
72
leadingActions: ListItemActions {
75
trailingActions: ListItemActions {
76
actions: contextualActions
78
expansion.height: units.gu(15)
83
margins: units.gu(0.5)
84
leftMargin: anchors.rightMargin
85
rightMargin: units.gu(2)
90
subtitle.text: "from index #" + index
93
text: "Enable drag mode"
94
onClicked: listView.ViewItems.dragMode = true
99
print("expand/collapse")
100
expansion.expanded = !expansion.expanded
105
Label { text: "Standalone ListItem" }
106
expansion.height: units.gu(15)
107
onPressAndHold: expansion.expanded = !expansion.expanded;
110
Label { text: "Other Standalone ListItem" }
111
expansion.height: units.gu(15)
112
onPressAndHold: expansion.expanded = !expansion.expanded;
116
text: "Set ListView.ViewItems.expandedIndices"
117
onClicked: listView.ViewItems.expandedIndices = [0, 1, 2]