From 70f43db915a2ae728533b3602b9713503478a4f7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 13 Mar 2017 08:47:36 +0100 Subject: Wearable: set the application background in the window ApplicationWindow comes with built-in support for custom backgrounds. Change-Id: I524d346a39f28e916d87bef738ad0492ee686c0c Reviewed-by: Mitch Curtis --- examples/quickcontrols2/wearable/qml/LauncherMain.qml | 8 -------- examples/quickcontrols2/wearable/qml/MainContainer.qml | 6 ------ examples/quickcontrols2/wearable/wearable.qml | 12 +++++++----- 3 files changed, 7 insertions(+), 19 deletions(-) (limited to 'examples/quickcontrols2') diff --git a/examples/quickcontrols2/wearable/qml/LauncherMain.qml b/examples/quickcontrols2/wearable/qml/LauncherMain.qml index 148701ec..f1fd02d1 100644 --- a/examples/quickcontrols2/wearable/qml/LauncherMain.qml +++ b/examples/quickcontrols2/wearable/qml/LauncherMain.qml @@ -68,43 +68,36 @@ Item { title: qsTr("World Clock") icon: "../images/watchface/watch.png" page: "WatchFace/WatchFaceMain.qml" - background: "../images/background/HomeBackground.png" } ListElement { // 1 title: qsTr("Navigation") icon: "../images/navigation/route.png" page: "Navigation/NavigationMain.qml" - background: "../images/background/HomeBackground.png" } ListElement { // 2 title: qsTr("Weather") icon: "../images/weather/weather.png" page: "Weather/WeatherMain.qml" - background: "../images/background/HomeBackground.png" } ListElement { // 3 title: qsTr("Fitness") icon: "../images/fitness/fitness.png" page: "Fitness/FitnessMain.qml" - background: "../images/background/HomeBackground.png" } ListElement { // 4 title: qsTr("Notifications") icon: "../images/notifications/notifications.png" page: "Notifications/NotificationsMain.qml" - background: "../images/background/HomeBackground.png" } ListElement { // 5 title: qsTr("Alarm") icon: "../images/alarms/alarms.png" page: "Alarms/AlarmsMain.qml" - background: "../images/background/HomeBackground.png" } ListElement { // 6 title: qsTr("Settings") icon: "../images/settings/settings.png" page: "Settings/SettingsMain.qml" - background: "../images/background/HomeBackground.png" } } @@ -221,7 +214,6 @@ Item { } } function loadPage() { - appBackgroundImg.source = background stackView.push(Qt.resolvedUrl(page)) } } diff --git a/examples/quickcontrols2/wearable/qml/MainContainer.qml b/examples/quickcontrols2/wearable/qml/MainContainer.qml index fc3a9a39..497de921 100644 --- a/examples/quickcontrols2/wearable/qml/MainContainer.qml +++ b/examples/quickcontrols2/wearable/qml/MainContainer.qml @@ -58,12 +58,6 @@ import "Navigation" import "Style" Item { - Image { - id: appBackgroundImg - anchors.fill: parent - source: "../images/background/HomeBackground.png" - } - Item { id: homeCntrl diff --git a/examples/quickcontrols2/wearable/wearable.qml b/examples/quickcontrols2/wearable/wearable.qml index b1ba2c2a..8d596665 100644 --- a/examples/quickcontrols2/wearable/wearable.qml +++ b/examples/quickcontrols2/wearable/wearable.qml @@ -49,22 +49,24 @@ ****************************************************************************/ import QtQuick 2.7 -import QtQuick.Window 2.0 +import QtQuick.Controls 2.0 import "qml" import "qml/Style" -Window { - id: rootWindow +ApplicationWindow { + id: window visible: true width: UIStyle.displayWidth height: UIStyle.displayHeight - color: UIStyle.colorQtGray1 - title: qsTr("Wearable") + background: Image { + source: "images/background/HomeBackground.png" + } + MainContainer { anchors.fill: parent } -- cgit v1.2.3