29
29
\brief Application toolbar. This class is not exposed because it will
30
30
be automatically added when a Page defines tools.
34
Theming.ItemStyle.class: "toolbar"
39
36
height: background.height
43
Use property bool opened instead.
45
property alias active: toolbar.opened
38
triggerSize: units.gu(2)
51
44
property ToolbarActions tools: null
53
if (tools && tools.opened && tools.locked) {
46
if (tools && tools.active && tools.lock) {
54
47
// toolbar is locked in visible state.
55
48
internal.visibleTools = tools;
57
} else if (!opened && !animating) {
50
} else if (!active && !animating) {
58
51
// toolbar is invisible
59
52
internal.visibleTools = tools;
62
55
// internal.visibleTools will be updated
63
56
// when the hide animation is finished
67
// if tools is not specified, lock the toolbar in closed position
68
locked: tools ? tools.locked : true
60
// if tools is not specified, lock the toolbar in inactive position
61
lock: tools ? tools.lock : true
72
onOpenedChanged: toolbar.opened = tools.opened;
73
onLockedChanged: toolbar.locked = tools.locked;
65
onActiveChanged: toolbar.active = tools.active;
75
onOpenedChanged: if (tools) tools.opened = toolbar.opened
76
onLockedChanged: if (tools) tools.locked = toolbar.locked
67
onActiveChanged: if (tools) tools.active = toolbar.active
79
70
property ToolbarActions visibleTools: tools
82
73
onAnimatingChanged: {
83
if (!animating && !opened) {
74
if (!animating && !active) {
84
75
internal.visibleTools = toolbar.tools;
90
// All theming items go into the background because only the children
91
// of the Panel are being shown/hidden while the toolbar
80
// All visual items go into the background because only the children
81
// of the GenericToolbar are being shown/hidden while the toolbar
92
82
// itself may stay in place.
99
89
height: units.gu(8)
101
Theming.ItemStyle.class: "toolbar"
102
// The values of opened and animated properties are used in the delegate
103
property bool opened: toolbar.opened
104
property bool animating: toolbar.animating
91
Theming.ItemStyle.style: toolbar.Theming.ItemStyle.style
92
Theming.ItemStyle.delegate: toolbar.Theming.ItemStyle.delegate
95
// don't let mouse events go through the toolbar
97
// FIXME: Bug in qml? Without onClicked below, this MouseArea
108
104
id: toolButtonComponent
111
107
Theming.ItemStyle.class: "toolbar-button"
112
property string text: action && action.text ? action.text : ""
113
property url iconSource: action && action.iconSource ? action.iconSource : ""
108
text: action && action.text ? action.text : ""
109
iconSource: action && action.iconSource ? action.iconSource : ""
115
110
onClicked: action.triggered(toolButton)
116
111
enabled: action && action.enabled
117
112
visible: action && action.visible
113
width: visible ? implicitWidth : 0
119
114
height: toolbar.height
132
127
onStatusChanged: {
133
128
if (item && status == Loader.Ready && action && action.itemHint) {
134
if (item.hasOwnProperty("clicked")) item.clicked.connect(backButton.itemTriggered);
135
if (item.hasOwnProperty("accepted")) item.accepted.connect(backButton.itemTriggered);
136
if (item.hasOwnProperty("triggered")) item.accepted.connect(backButton.itemTtriggered);
129
if (item.hasOwnProperty("clicked")) item.clicked.connect(action.triggered);
130
if (item.hasOwnProperty("accepted")) item.accepted.connect(action.triggered);
131
if (item.hasOwnProperty("triggered")) item.accepted.connect(action.triggered);
139
signal itemTriggered()
140
onItemTriggered: action.triggered(item)