ToolbarButton
An ActionItem that represents a button in the toolbar. ToolbarButtons should be included in ToolbarItems to define the tools of a Page. The behavior and look of the toolbar button can be specified by setting an Action for the button, or by setting the other properties inherited by the ActionItem. More...
Inherits ActionItem
Properties
- action : Action
- iconSource : url
- style : Component
- text : string
Detailed Description
Example of different ways to define the toolbar button:
import QtQuick 2.0 import Ubuntu.Components 0.1 MainView { width: units.gu(50) height: units.gu(80) Action { id: action1 text: "action 1" iconSource: Qt.resolvedUrl("icon1.png") onTriggered: print("one!") } Page { title: "test page" Label { anchors.centerIn: parent text: "Hello, world" } tools: ToolbarItems { // reference to an action: ToolbarButton { action: action1 } // define the action: ToolbarButton { action: Action { text: "Second action" iconSource: Qt.resolvedUrl("icon2.png") onTriggered: print("two!") } // override the text of the action: text: "action 2" } // no associated action: ToolbarButton { iconSource: Qt.resolvedUrl("icon3.png") text: "button" onTriggered: print("three!") } } } }
See ToolbarItems for more information on how to use ToolbarButton.
Property Documentation
action : Action |
The Action associated with this ActionItem. If action is set, the values of the Action properties are copied to the values of the ActionItem properties.
The image associated with the actionItem. Default value: action.iconSource.
The title of the actionItem. Default value: action.text