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 Ubuntu.Components 1.3
20
// FIXME: In the example code below, replace the delegate
21
// by the new text button when it becomes available.
24
\inqmlmodule Ubuntu.Components 1.3
26
\brief Toolbar that can be used as an extension for the edit mode header.
31
property Component delegate: Component {
35
width: label.width + units.gu(4)
38
color: UbuntuColors.darkGrey
41
visible: button.pressed
44
anchors.centerIn: parent
47
font.weight: text === "Confirm" ? Font.Normal : Font.Light
58
delegate: editHeader.delegate
61
anchors.rightMargin: 0
66
delegate: editHeader.delegate
75
trailingActionBar.actions: [
76
Action { iconName: "bookmark-new" },
77
Action { iconName: "add" },
78
Action { iconName: "edit-select-all" },
79
Action { iconName: "edit-copy" },
80
Action { iconName: "select" }
82
leadingActionBar.actions: Action {
85
onTriggered: print("Delete action triggered")
94
styleName: "ToolbarStyle"
97
\qmlproperty ActionBar leadingActionBar
98
The leading ActionBar that should hold at most one action.
99
Recommneded for the delete action.
103
leadingActionBar.actions: [
107
onTriggered: print("delete!")
114
readonly property alias leadingActionBar: leading
120
bottom: parent.bottom
121
leftMargin: units.gu(1)
124
delegate: toolbar.__styleInstance.defaultDelegate
125
Component.onCompleted: {
126
if (actions && actions.length > 1) {
127
print("WARNING: Toolbar with more than one leading actions is not supported.");
133
\qmlproperty ActionBar trailingActionBar
134
The \l ActionBar with trailing actions.
138
trailingActionBar.actions: [
139
Action { iconName: "bookmark-new" },
140
Action { iconName: "add" },
141
Action { iconName: "edit-select-all" },
142
Action { iconName: "edit-copy" }
146
The trailing ActionBar may contain up to 8 actions.
147
Scrolling and support for more than 8 actions will be added in the near future.
150
readonly property alias trailingActionBar: trailing
156
bottom: parent.bottom
157
rightMargin: units.gu(1)
160
delegate: toolbar.__styleInstance.defaultDelegate
161
Component.onCompleted: {
162
if (actions && actions.length > 8) {
163
print("WARNING: Toolbar with more than one leading actions is not supported.");