~ci-train-bot/ubuntu-settings-components/ubuntu-settings-components-ubuntu-zesty-2202

« back to all changes in this revision

Viewing changes to examples/OtherComponents.qml

  • Committer: Bileto Bot
  • Date: 2016-11-16 18:52:43 UTC
  • mfrom: (146.4.57 touch+pointer-styles)
  • Revision ID: ci-train-bot@canonical.com-20161116185243-o399ryjh002umz1a
* Menus: add Pointer and Touch styles to be used depending on the user
  interaction with components
  Menu items now have a new Style property that defines some common properties
  such as shared colors and sizes that change depending on the UX journey. I'm
  only defining Pointer and TouchStyles for now, but they can be easily
  overridden in case.
  Removed some deprecated properties and adapted colors and sizes to new
  style.
* Bump package version as there's a new API for various components

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import Ubuntu.Settings.Menus 0.1
23
23
 
24
24
Item {
 
25
    id: page
25
26
    property string title: "Settings Components"
 
27
    property bool pointerMode: false
26
28
 
27
29
    width: parent && parent.width ? parent.width : units.gu(42)
28
30
    height: parent && parent.width ? parent.height : units.gu(75)
66
68
                onTriggered: console.log("Triggered")
67
69
            }
68
70
 
69
 
            StandardMenu {
70
 
                id: dividerToggleMenu
 
71
            ButtonMenu {
71
72
                text: i18n.tr("Toggle divider menu.")
72
 
                showDivider: false
73
 
 
74
 
                slots: [
75
 
                    Button {
76
 
                        text: dividerToggleMenu.showDivider ? i18n.tr("Hide") : i18n.tr("Show")
77
 
                        onClicked: dividerToggleMenu.showDivider = !dividerToggleMenu.showDivider
78
 
                    }
79
 
                ]
 
73
                buttonText: divider.visible ? i18n.tr("Hide") : i18n.tr("Show")
 
74
                onButtonClicked: divider.visible = !divider.visible
80
75
            }
81
76
 
82
77
            StandardMenu {
96
91
                iconName: "calendar"
97
92
                iconColor: "red"
98
93
                text: i18n.tr("Standard Menu with Component")
99
 
                component: Component {
100
 
                    Button {
101
 
                        text: "Press Me"
102
 
                        onClicked: print("Button pressed!")
103
 
                    }
 
94
                slots: Button {
 
95
                    text: "Press Me"
 
96
                    onClicked: print("Button pressed!")
 
97
                    color: theme.palette.normal.foreground
104
98
                }
105
99
            }
106
100
 
260
254
                    TimeZoneMenu {
261
255
                        city: model.city
262
256
                        time: model.time
 
257
                        pointerMode: page.pointerMode
263
258
                    }
264
259
                }
265
260
            }
279
274
                        eventColor: model.eventColor
280
275
                        time: model.time
281
276
                        enabled: false
 
277
                        pointerMode: page.pointerMode
 
278
                    }
 
279
                }
 
280
            }
 
281
 
 
282
            Component.onCompleted: {
 
283
                for (var i = 0; i < children.length; ++i) {
 
284
                    if (children[i].pointerMode !== undefined) {
 
285
                        children[i].pointerMode = Qt.binding(function() { return page.pointerMode })
282
286
                    }
283
287
                }
284
288
            }