/*
* Copyright 2012 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*/
import QtQuick 2.4
/*!
\qmltype ToolbarItems
\inqmlmodule Lomiri.Components
\ingroup lomiri
\deprecated
\brief Row of Items to be placed in a toolbar.
\b DEPRECATED: DO NOT USE THIS. USE \b head.actions IN \l Page INSTEAD.
\deprecated
Each \l Page has a tools property that can be set to change the tools of toolbar supplied
by \l MainView when the \l Page is active. Each ToolbarItems consists of a set of
Items and several properties that specify the behavior of the toolbar when the \l Page
is active.
When a \l Page is used inside a \l MainView, \l Tabs or \l PageStack, the toolbar will automatically show
the tools of the active \l Page. When the active \l Page inside the \l Tabs or \l PageStack
is updated by changing the selected \l Tab or by pushing/popping a \l Page on the \l PageStack,
the toolbar will automatically hide, except if the new active \l Page has the \l locked property set.
It is recommended to use \l ToolbarButton inside the ToolbarItems to define the buttons that will
be visible to the user:
\qml
import QtQuick 2.4
import Lomiri.Components
MainView {
width: units.gu(50)
height: units.gu(50)
Page {
title: "Tools example"
Label {
anchors.centerIn: parent
text: "Custom back button\nToolbar locked"
}
tools: ToolbarItems {
ToolbarButton {
action: Action {
text: "button"
iconName: "compose"
onTriggered: print("success!")
}
}
locked: true
opened: true
}
}
}
\endqml
However, it is possible to include non-\l ToolbarButton Items inside ToolbarItems, and to mix
ToolbarButtons and other Items (for example standard Buttons). ToolbarButtons automatically span
the full height of the toolbar, and other Items you will probably want to center vertically:
\qml
import QtQuick 2.4
import Lomiri.Components
MainView {
width: units.gu(50)
height: units.gu(50)
Page {
title: "Tools example"
Label {
anchors.centerIn: parent
text: "buttons!"
}
tools: ToolbarItems {
ToolbarButton {
action: Action {
text: "toolbar"
iconName: "compose"
onTriggered: print("success!")
}
}
Button {
anchors.verticalCenter: parent.verticalCenter
text: "standard"
}
}
}
}
\endqml
*/
Item {
id: toolbarItems
anchors.fill: parent
/*!
Default property, holds the content which will shown in the toolbar.
\qmlproperty list