~zsombi/ubuntu-ui-toolkit/labelThemingFix

« back to all changes in this revision

Viewing changes to examples/ubuntu-ui-toolkit-gallery/Sections.qml

  • Committer: Tarmac
  • Author(s): Tim Peeters
  • Date: 2016-02-26 11:38:24 UTC
  • mfrom: (1732.9.66 60-scectionScrolling)
  • Revision ID: tarmac-20160226113824-68ud6a1kcgsy7ha3
Sections scrolling and keyboard navigation. Fixes: https://bugs.launchpad.net/bugs/1465048, https://bugs.launchpad.net/bugs/1489591.

Approved by ubuntu-sdk-build-bot, Christian Dywan.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    id: sectionsTemplate
23
23
 
24
24
    header: PageHeader {
 
25
        id: h
25
26
        title: sectionsTemplate.title
26
 
        sections.model: ["first", "second", "third"]
 
27
        extension: Sections {
 
28
            anchors {
 
29
                left: parent.left
 
30
                right: parent.right
 
31
                bottom: parent.bottom
 
32
            }
 
33
            model: h.showManySections ? sectionsTemplate.manyActions
 
34
                                      : sectionsTemplate.fewActions
 
35
        }
 
36
        property bool showManySections: false
 
37
        trailingActionBar.actions: [
 
38
            Action {
 
39
                iconName: h.showManySections ? "view-collapse" : "view-expand"
 
40
                text: h.showManySections ? "less" : "more"
 
41
                onTriggered: h.showManySections = !h.showManySections;
 
42
            }
 
43
        ]
27
44
    }
28
45
 
 
46
    property list<Action> fewActions: [
 
47
        Action { text: "One" },
 
48
        Action { text: "Two" },
 
49
        Action { text: "Three" }
 
50
    ]
 
51
 
 
52
    property var manyActions: [
 
53
        "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
 
54
        "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
 
55
        "sixteen", "seventeen", "eighteen", "nineteen", "twenty"
 
56
    ]
 
57
 
29
58
    TemplateSection {
30
59
        title: "Sections"
31
60
        className: "Sections"
34
63
            title: i18n.tr("Enabled")
35
64
 
36
65
            Sections {
37
 
                actions: [
38
 
                    Action { text: "one" },
39
 
                    Action { text: "two" },
40
 
                    Action { text: "three" }
41
 
                ]
42
 
            }
43
 
        }
44
 
        TemplateRow {
45
 
            title: i18n.tr("Disabled")
46
 
 
47
 
            Sections {
48
 
                model: ["one", "two", "three"]
49
 
                enabled: false
 
66
                actions: sectionsTemplate.fewActions
 
67
            }
 
68
        }
 
69
        TemplateRow {
 
70
            title: i18n.tr("Disabled")
 
71
 
 
72
            Sections {
 
73
                model: sectionsTemplate.fewActions
 
74
                enabled: false
 
75
            }
 
76
        }
 
77
    }
 
78
 
 
79
    TemplateSection {
 
80
        title: "Scrollable sections"
 
81
        className: "Sections"
 
82
 
 
83
        TemplateRow {
 
84
            title: i18n.tr("Enabled")
 
85
 
 
86
            Sections {
 
87
                model: sectionsTemplate.manyActions
 
88
                width: parent.width
 
89
            }
 
90
        }
 
91
        TemplateRow {
 
92
            title: i18n.tr("Disabled")
 
93
 
 
94
            Sections {
 
95
                model: sectionsTemplate.manyActions
 
96
                enabled: false
 
97
                width: parent.width
50
98
            }
51
99
        }
52
100
    }