~bzoltan/ubuntu-ui-toolkit/landing_2015-06-26

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/1.3/PageHeadSections.qml

  • Committer: Tarmac
  • Author(s): Tim Peeters
  • Date: 2015-06-23 18:03:09 UTC
  • mfrom: (1518.4.18 110-newHeader2)
  • Revision ID: tarmac-20150623180309-jim81d8ol10b956p
New header visuals, using the ActionBar and Sections components.

Approved by PS Jenkins bot, Christian Dywan.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 */
16
16
 
17
17
import QtQuick 2.4
 
18
import Ubuntu.Components 1.3
18
19
 
19
20
/*!
20
21
    \qmltype PageHeadSections
25
26
 
26
27
    These sections will be shown in the bottom part of the header. This component does not
27
28
    need to be instantiated by the developer, it is automatically part of \l PageHeadConfiguration.
 
29
 
 
30
    See also \l Sections.
28
31
 */
29
32
QtObject {
30
33
    // To be used inside PageHeadConfiguration
37
40
    property bool enabled: true
38
41
 
39
42
    /*!
40
 
      List of strings that represent section names. Example:
 
43
      The input model for the sections. By default model takes the \l actions
 
44
      as input, but if no trigger functions need to be specified, it can be
 
45
      simplified to a list of strings naming the sections:
41
46
      \qml
42
47
        import Ubuntu.Components 1.3
43
48
        import QtQuick 2.4
54
59
                        model: ["one", "two", "three"]
55
60
                    }
56
61
                }
57
 
 
58
62
                Label {
59
63
                    anchors.centerIn: parent
60
64
                    text: "Section " + page.head.sections.selectedIndex
64
68
     \endqml
65
69
     It is strongly recommended to limit the number of sections to two or three.
66
70
     */
67
 
    property var model
68
 
    onModelChanged: {
69
 
        if (model && model.length > 3) {
70
 
            console.warn("It is not recommended or supported to use more than three sections in Page.head.sections.model.");
71
 
        }
72
 
    }
 
71
    property var model: actions
 
72
 
 
73
    /*!
 
74
      List of actions that represent the sections.
 
75
      The text of each action is displayed as the section name and clicking
 
76
      a section will update the \l selectedIndex.
 
77
 
 
78
      When \l selectedIndex is changed (by user interaction or by setting
 
79
      the value), actions[selectedIndex] will be triggered.
 
80
 
 
81
      \since Ubuntu.Components 1.3
 
82
     */
 
83
    property list<Action> actions
73
84
 
74
85
    /*!
75
86
      The index of the currently selected section in \l model.