Sections QML Type
Display a list of sections that the user can select. By tapping on a section name the selectedIndex will be updated, and the associated Action is triggered. More...
Import Statement: | import Ubuntu.Components 1.2 |
Since: | Ubuntu.Components 1.3 |
Inherits: |
Properties
- actions : Action
- model : var
- selectedIndex : int
Detailed Description
Property Documentation
actions : Action |
List of actions that represent the sections. The text of each action is displayed as the section name and clicking a section will update the selectedIndex.
When selectedIndex is changed (by user interaction or by setting the value), actions[selectedIndex] will be triggered.
Example:
Sections { actions: [ Action { text: "first" onTriggered: print("one") }, Action { text: "second" onTriggered: print("two") }, Action { text: "third" onTriggered: print("three") } ] }
It is strongly recommended to limit the number of sections to two or three. The actions are used as the model for the Sections by default. If no trigger functions need to be specified, model may be used directly without setting the actions property. If both actions and model are set, model overrides the actions.
model : var |
The input model for the sections. By default model takes the actions as input, but if no trigger functions need to be specified, it can be simplified to a list of strings naming the sections:
Sections { model: [ "one", "two", "three" ] onSelectedIndexChanged: { print("Selected section " + model[selectedIndex]); } }
The index of the currently selected section in model.