ToolbarActions

List of Action items with additional properties to control a toolbar. More...

Properties

Detailed Description

Each Page has a tools property that can be set to change the tools of toolbar supplied by MainView when the Page is active. Each ToolbarActions consists of a set of Action items and several properties that specify the behavior of the toolbar when the Page is active.

When a Page is used inside a Tabs or PageStack, the toolbar will automatically show the tools of the active Page. When the active Page inside the Tabs or PageStack is updated by changing the selected Tab or by pushing/popping a Page on the PageStack, the toolbar will automatically hide, except if the new active Page has the lock property set.

import QtQuick 2.0
import Ubuntu.Components 0.1

MainView {
    width: units.gu(50)
    height: units.gu(50)

    Page {
        title: "Tools example"
        Label {
            anchors.centerIn: parent
            text: "Custom back button\nToolbar locked"
        }
        tools: ToolbarActions {
            Action {
                text: "action 1"
                iconSource: Qt.resolvedUrl("call_icon.png")
            }
            Action {
                text: "action 2"
                iconSource: Qt.resolvedUrl("call_icon.png")
            }
            back {
                itemHint: Button {
                    id: cancelButton
                    text: "cancel"
                }
            }
            lock: true
            active: true
        }
    }
}

Property Documentation

active : bool

The toolbar is active


back : Action

The back Action. If the action is visible, the back button will be shown on the left-side of the toolbar. If there is a PageStack with depth greater than 1, the back action will be visible and triggering it will pop the page on top of the stack. If there is no PageStack with depth greater than 1, the back action is hidden by default (but the default setting can be changed by setting its visible property).


lock : bool

The toolbar cannot be made active or inactive by bottom-edge swipes. If the ToolbarActions contains no visible actions, it is automatically locked (in inactive state).