aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2/wearable/wearable.qml
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2018-09-10 16:15:01 +0200
committerMitch Curtis <mitch.curtis@qt.io>2018-09-27 11:39:47 +0000
commitfb6763fddfce329924ccb3678fbdf7875978a7ca (patch)
tree9a27d6b9c9ccbb5f954bb57c55c655fd3c59eedb /examples/quickcontrols2/wearable/wearable.qml
parent8a87193078d7a51c5a049e4698c44b0af43edbb3 (diff)
wearable: add a dark theme with a runtime switch on the Settings page
Change-Id: Iaa205c19aa413de7a5537f17f74d969547d5e558 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'examples/quickcontrols2/wearable/wearable.qml')
-rw-r--r--examples/quickcontrols2/wearable/wearable.qml26
1 files changed, 22 insertions, 4 deletions
diff --git a/examples/quickcontrols2/wearable/wearable.qml b/examples/quickcontrols2/wearable/wearable.qml
index 6be65d1b..62f138bb 100644
--- a/examples/quickcontrols2/wearable/wearable.qml
+++ b/examples/quickcontrols2/wearable/wearable.qml
@@ -50,21 +50,39 @@
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 contrast
+ property int brightness
+ property bool darkTheme
+ }
+
+ 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 {