aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2018-09-04 10:38:32 +0200
committerMitch Curtis <mitch.curtis@qt.io>2018-09-10 08:52:15 +0000
commitb41a32bc8ed42001c59af22345af4b733398aa34 (patch)
treef0b205ee8b46cc94054e282150fab37ac3bdb81a /examples
parentc4012e9a25514a76ae8f826142a3a3b121c9f322 (diff)
wearable: fix items still being visible when returning to LauncherPage
Hide SwipeView items when appropriate, as it's not done automatically. Change-Id: Ic716da004794b7d0eba65c220f6242d4113302d9 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml3
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml5
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml5
-rw-r--r--examples/quickcontrols2/wearable/qml/SwipeViewPage.qml60
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml9
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml4
-rw-r--r--examples/quickcontrols2/wearable/wearable.qrc1
7 files changed, 77 insertions, 10 deletions
diff --git a/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
index e07908ee..82a7716f 100644
--- a/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
@@ -50,6 +50,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0 as QQC2
+import ".."
import "../Style"
Item {
@@ -64,7 +65,7 @@ Item {
ListElement { name: qsTr("Week Ends"); state: false; time: "07:30 AM" }
}
- Item {
+ SwipeViewPage {
Column {
spacing: 30
anchors.centerIn: parent
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml b/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
index b3b0a0c5..a9a1cb98 100644
--- a/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
@@ -50,6 +50,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0 as QQ2
+import ".."
import "../Style"
import "fitness.js" as FitnessData
@@ -59,7 +60,7 @@ Item {
anchors.fill: parent
- Item {
+ SwipeViewPage {
id: fitnessPage1
Column {
@@ -87,7 +88,7 @@ Item {
}
}
- Item {
+ SwipeViewPage {
id: fitnessPage2
Column {
diff --git a/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml b/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml
index 48f3a3d6..3ed59eb8 100644
--- a/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml
@@ -51,6 +51,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0 as QQC2
import Qt.labs.settings 1.0
+import ".."
import "../Style"
Item {
@@ -68,7 +69,7 @@ Item {
anchors.fill: parent
- Item {
+ SwipeViewPage {
id: settingsPage1
Column {
@@ -102,7 +103,7 @@ Item {
}
}
- Item {
+ SwipeViewPage {
id: settingsPage2
Column {
diff --git a/examples/quickcontrols2/wearable/qml/SwipeViewPage.qml b/examples/quickcontrols2/wearable/qml/SwipeViewPage.qml
new file mode 100644
index 00000000..0a9ada57
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/SwipeViewPage.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Controls 2.1
+
+Item {
+ // Don't show the item when the StackView that contains us
+ // is being popped off the stack, as we use an x animation
+ // and hence would show pages that we shouldn't since we
+ // also don't have our own background.
+ visible: SwipeView.isCurrentItem || (SwipeView.view.contentItem.moving && (SwipeView.isPreviousItem || SwipeView.isNextItem))
+}
diff --git a/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml b/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
index 2ef0133c..a02b44ee 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
@@ -50,6 +50,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0 as QQC2
+import ".."
import "../Style"
import "weather.js" as WeatherData
@@ -59,7 +60,7 @@ Item {
anchors.fill: parent
- Item {
+ SwipeViewPage {
id: weatherPage1
Row {
@@ -114,7 +115,7 @@ Item {
}
}
- Item {
+ SwipeViewPage {
id: weatherPage2
Column {
@@ -169,7 +170,7 @@ Item {
}
}
- Item {
+ SwipeViewPage {
id: weatherPage3
Row {
@@ -224,7 +225,7 @@ Item {
}
}
- Item {
+ SwipeViewPage {
id: weatherPage4
Column {
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml b/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml
index a6e67e8c..e3da38c7 100644
--- a/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml
@@ -49,9 +49,11 @@
****************************************************************************/
import QtQuick 2.7
+import QtQuick.Controls 2.0 as QQC2
+import ".."
import "../Style"
-Item {
+SwipeViewPage {
id: clock
property int hours
diff --git a/examples/quickcontrols2/wearable/wearable.qrc b/examples/quickcontrols2/wearable/wearable.qrc
index ea81edc6..d71b5bab 100644
--- a/examples/quickcontrols2/wearable/wearable.qrc
+++ b/examples/quickcontrols2/wearable/wearable.qrc
@@ -103,5 +103,6 @@
<file>qml/WorldClock/images/swissnighthour@2x.png</file>
<file>qml/WorldClock/images/swissnightminute.png</file>
<file>qml/WorldClock/images/swissnightminute@2x.png</file>
+ <file>qml/SwipeViewPage.qml</file>
</qresource>
</RCC>