Page

A page is the basic Item that must be used inside the MainView, PageStack and Tabs. Anchors and height of a Page are automatically determined to align with the header of the MainView, but can be overridden. More...

Inherits StyledItem

Properties

Detailed Description

MainView provides a header and toolbar for Pages it includes. Each page automatically has its header and toolbar property linked to that of its parent MainView. The text of the header, and the buttons in the toolbar are determined by the title and tools properties of the page:

import QtQuick 2.0
import Ubuntu.Components 0.1

MainView {
    width: units.gu(48)
    height: units.gu(60)

    Page {
        title: "Example page"

        Label {
            anchors.centerIn: parent
            text: "Hello world!"
        }

        tools: ToolbarItems {
            ToolbarButton {
                action: Action {
                    text: "one"
                }
             }
            ToolbarButton {
                action: Action {
                    text: "two"
                }
            }
        }
    }
}

See MainView for more basic examples that show how to use a header and toolbar. Advanced navigation structures can be created by adding Pages to a PageStack or Tabs.

Property Documentation

actions : list<Action>

Local actions. These actions will be made available outside the application (for example, to HUD) when the Page is active. For actions that are always available when the application is running, use the actions property of MainView.


flickable : Flickable

Optional flickable that controls the header. This property is automatically set to the first child of the page that is Flickable and anchors to the top of the page or fills the page. For example:

import QtQuick 2.0
import Ubuntu.Components 0.1

MainView {
    width: units.gu(30)
    height: units.gu(50)
    Page {
        id: page
        title: "example"
        //flickable: null // uncomment to disable hiding of the header
        Flickable {
            id: content
            anchors.fill: parent
            contentHeight: units.gu(70)
            Label {
                text: "hello"
                anchors.centerIn: parent
            }
        }
    }
}

In this example, page.flickable will automatically be set to content because it is a Flickable and it fills its parent. Thus, scrolling down in the Flickable will automatically hide the header.

This property be set to null to avoid automatic flickable detection, which disables hiding of the header by scrolling in the Flickable. In cases where a flickable should control the header, but it is not automatically detected, the flickable property can be set.


title : string

The title of the page. Will be shown in the header of the MainView.


tools : Item

The toolbar items associated with this Page. It is recommended to use ToolbarItems to specify the tools, but any Item is allowed here.