diff options
Diffstat (limited to 'examples/quickcontrols2/wearable/wearable.qml')
-rw-r--r-- | examples/quickcontrols2/wearable/wearable.qml | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/examples/quickcontrols2/wearable/wearable.qml b/examples/quickcontrols2/wearable/wearable.qml index 01d52b12..ea84adca 100644 --- a/examples/quickcontrols2/wearable/wearable.qml +++ b/examples/quickcontrols2/wearable/wearable.qml @@ -48,23 +48,41 @@ ** ****************************************************************************/ -import QtQuick 2.7 -import QtQuick.Controls 2.0 as QQC2 +import QtQuick 2.10 +import QtQuick.Controls 2.3 as QQC2 +import Qt.labs.settings 1.0 import "qml" import "qml/Style" QQC2.ApplicationWindow { id: window - visible: true - width: 320 height: 320 - title: qsTr("Wearable") + Settings { + id: settings + property bool wireless + property bool bluetooth + property int brightness + property bool darkTheme + property bool demoMode + } + + Binding { + target: UIStyle + property: "darkTheme" + value: settings.darkTheme + } + + // We need the settings object both here and in SettingsPage, + // so for convenience, we declare it as a property of the root object so that + // it will be available to all of the QML files that we load. + property alias settings: settings + background: Image { - source: "images/background.png" + source: "images/background-" + (settings.darkTheme ? "dark" : "light") + ".png" } header: NaviButton { @@ -97,4 +115,26 @@ QQC2.ApplicationWindow { onLaunched: stackView.push(page) } } + + DemoMode { + stackView: stackView + } + + DemoModeIndicator { + id: demoModeIndicator + y: settings.demoMode ? -height : -height * 2 + anchors.horizontalCenter: parent.horizontalCenter + height: header.height + z: window.header.z + 1 + } + + MouseArea { + enabled: settings.demoMode + anchors.fill: parent + onClicked: { + // Stop demo mode and return to the launcher page. + settings.demoMode = false + stackView.pop(null) + } + } } |