aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-30 13:46:40 +0200
committerLiang Qi <liang.qi@qt.io>2017-03-30 13:46:40 +0200
commitc3cc73e3087db62a8427ff569abff1a8289dae83 (patch)
tree9839a823f220f57775a732658b8aab0fa4ba9be3
parent2e0cded94716430658d4afe3e0fdd6fe4cf6362c (diff)
parentbc514fba81b67afb41ee91ea917352ad674630a5 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/imports/controls/RangeSlider.qml Change-Id: I0b930583135f044cb690217c026e6a120b73fcb7
-rw-r--r--.gitignore1
-rw-r--r--examples/quickcontrols2/quickcontrols2.pro3
-rw-r--r--examples/quickcontrols2/wearable/doc/images/qtquickcontrols2-wearable.pngbin0 -> 115578 bytes
-rw-r--r--examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc162
-rw-r--r--examples/quickcontrols2/wearable/images/back.pngbin0 -> 1691 bytes
-rw-r--r--examples/quickcontrols2/wearable/images/background.pngbin0 -> 400411 bytes
-rw-r--r--examples/quickcontrols2/wearable/images/home.pngbin0 -> 1780 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml111
-rw-r--r--examples/quickcontrols2/wearable/qml/Alarms/images/alarms.pngbin0 -> 19340 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml130
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/fitness.js65
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/fitness.pngbin0 -> 19110 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/man-running.pngbin0 -> 16047 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/man-walking.pngbin0 -> 16062 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/LauncherPage.qml192
-rw-r--r--examples/quickcontrols2/wearable/qml/NaviButton.qml83
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml118
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml95
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/end.pngbin0 -> 16408 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/leftturn.pngbin0 -> 16111 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/marker.pngbin0 -> 16408 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/rightturn.pngbin0 -> 16077 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/route.pngbin0 -> 19411 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/start.pngbin0 -> 16411 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/straight.pngbin0 -> 15727 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/uturn.pngbin0 -> 3254 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/navigation.js131
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/walk_route.json1
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml112
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/avatarf.pngbin0 -> 16396 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/avatarm.pngbin0 -> 16198 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/missedcall.pngbin0 -> 2833 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/notifications.pngbin0 -> 19625 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/notifications.js72
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml152
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/bluetooth.pngbin0 -> 2770 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/brightness.pngbin0 -> 2692 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/contrast.pngbin0 -> 2347 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/settings.pngbin0 -> 19715 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/wifi.pngbin0 -> 16308 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml89
-rw-r--r--examples/quickcontrols2/wearable/qml/Style/Slider.qml86
-rw-r--r--examples/quickcontrols2/wearable/qml/Style/Switch.qml86
-rw-r--r--examples/quickcontrols2/wearable/qml/Style/UIStyle.qml84
-rw-r--r--examples/quickcontrols2/wearable/qml/Style/qmldir1
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml296
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/humidity.pngbin0 -> 16450 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/pressure.pngbin0 -> 16902 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/sunrise.pngbin0 -> 16534 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/sunset.pngbin0 -> 16586 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/temperature.pngbin0 -> 2004 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/weather.pngbin0 -> 19281 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/wind.pngbin0 -> 16440 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/weather.js77
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/weather.json1
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml186
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml107
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/center.pngbin0 -> 765 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/clock-night.pngbin0 -> 25619 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/clock.pngbin0 -> 15616 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/second.pngbin0 -> 1015 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/swissdaydial.pngbin0 -> 7999 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayhour.pngbin0 -> 1088 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayminute.pngbin0 -> 1109 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightdial.pngbin0 -> 8899 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/swissnighthour.pngbin0 -> 1117 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightminute.pngbin0 -> 1063 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/swissseconds.pngbin0 -> 2752 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/images/watch.pngbin0 -> 19015 bytes
-rw-r--r--examples/quickcontrols2/wearable/wearable.cpp65
-rw-r--r--examples/quickcontrols2/wearable/wearable.pro12
-rw-r--r--examples/quickcontrols2/wearable/wearable.qml100
-rw-r--r--examples/quickcontrols2/wearable/wearable.qrc67
-rw-r--r--src/imports/controls/RangeSlider.qml9
-rw-r--r--src/imports/controls/designer/BusyIndicatorSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ButtonSpecifics.qml4
-rw-r--r--src/imports/controls/designer/CheckBoxSpecifics.qml4
-rw-r--r--src/imports/controls/designer/CheckDelegateSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ComboBoxSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ControlSpecifics.qml4
-rw-r--r--src/imports/controls/designer/DialSpecifics.qml4
-rw-r--r--src/imports/controls/designer/FrameSpecifics.qml4
-rw-r--r--src/imports/controls/designer/GroupBoxSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ItemDelegateSpecifics.qml4
-rw-r--r--src/imports/controls/designer/PageIndicatorSpecifics.qml4
-rw-r--r--src/imports/controls/designer/PaneSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ProgressBarSpecifics.qml4
-rw-r--r--src/imports/controls/designer/RadioButtonSpecifics.qml4
-rw-r--r--src/imports/controls/designer/RadioDelegateSpecifics.qml4
-rw-r--r--src/imports/controls/designer/SliderSpecifics.qml4
-rw-r--r--src/imports/controls/designer/SpinBoxSpecifics.qml4
-rw-r--r--src/imports/controls/designer/SwipeDelegateSpecifics.qml4
-rw-r--r--src/imports/controls/designer/SwitchSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ToolBarSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ToolButtonSpecifics.qml4
-rw-r--r--src/imports/controls/designer/TumblerSpecifics.qml4
-rw-r--r--src/imports/controls/designer/images/scrollview-icon.pngbin0 -> 157 bytes
-rw-r--r--src/imports/controls/designer/images/scrollview-icon16.pngbin0 -> 147 bytes
-rw-r--r--src/imports/controls/designer/qtquickcontrols2.metainfo20
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button.gifbin1863 -> 4140 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-rangeslider.gifbin17402 -> 24125 bytes
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml53
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc13
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-popups.qdoc2
-rw-r--r--src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp1
-rw-r--r--src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp2
-rw-r--r--src/imports/platform/platform.pri14
-rw-r--r--src/imports/platform/qquickplatformmenu.cpp9
-rw-r--r--src/imports/platform/qquickplatformsystemtrayicon_p.h2
-rw-r--r--src/imports/platform/qtlabsplatformplugin.cpp7
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenu.cpp25
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenu_p.h3
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenuitem.cpp12
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenuitem_p.h3
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp2
-rw-r--r--src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp2
-rw-r--r--src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h2
-rw-r--r--src/imports/platform/widgets/widgets.pri11
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp2
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp2
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp8
-rw-r--r--src/quicktemplates2/qquickcombobox_p.h2
-rw-r--r--src/quicktemplates2/qquickpopup.cpp9
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp6
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp6
-rw-r--r--tests/auto/applicationwindow/data/clearfocusondestruction.qml74
-rw-r--r--tests/auto/applicationwindow/tst_applicationwindow.cpp42
-rw-r--r--tests/auto/controls/data/tst_swipedelegate.qml207
-rw-r--r--tests/auto/snippets/tst_snippets.cpp13
-rw-r--r--tests/manual/gifs/tst_gifs.cpp2
130 files changed, 3190 insertions, 148 deletions
diff --git a/.gitignore b/.gitignore
index f0b55ccf..6b88d21f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@
/examples/quickcontrols2/sidepanel/sidepanel
/examples/quickcontrols2/swipetoremove/swipetoremove
/examples/quickcontrols2/texteditor/texteditor
+/examples/quickcontrols2/wearable/wearable
/tests/auto/accessibility/tst_accessibility
/tests/auto/applicationwindow/tst_applicationwindow
diff --git a/examples/quickcontrols2/quickcontrols2.pro b/examples/quickcontrols2/quickcontrols2.pro
index 3e145a41..858759fb 100644
--- a/examples/quickcontrols2/quickcontrols2.pro
+++ b/examples/quickcontrols2/quickcontrols2.pro
@@ -6,4 +6,5 @@ SUBDIRS += \
contactlist \
sidepanel \
swipetoremove \
- flatstyle
+ flatstyle \
+ wearable
diff --git a/examples/quickcontrols2/wearable/doc/images/qtquickcontrols2-wearable.png b/examples/quickcontrols2/wearable/doc/images/qtquickcontrols2-wearable.png
new file mode 100644
index 00000000..e01b3687
--- /dev/null
+++ b/examples/quickcontrols2/wearable/doc/images/qtquickcontrols2-wearable.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc b/examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc
new file mode 100644
index 00000000..4ae3233c
--- /dev/null
+++ b/examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example wearable
+ \title Qt Quick Controls 2 - Wearable Demo
+ \ingroup qtquickcontrols2-examples
+ \brief A QML app using Qt Quick Controls 2 and demonstrating how to create a
+ collection of wearable sub-apps using custom QML screens.
+
+ \image qtquickcontrols2-wearable.png
+
+ The \e {Wearable} demo is a collection of sub-apps. Each sub-app is
+ contained within its own .qml file, and integrated into \c LauncherMain.qml.
+ The app demonstrates following \l {Qt Quick} features:
+
+ \list
+ \li Using custom types to create screens and screen controls.
+ \li Using Qt Quick Controls 2 with namespace.
+ \li Using layout components such as \l [QML] Column and \l [QML] Row
+ \li Using XMLHttpRequest to load data from local files.
+ \li Using PathView, \l [QML] Path, PathAttribute, and PathLine types to
+ lay out UI elements.
+ \endlist
+
+ \section1 Creating the Main Window
+
+ In \c wearable.qml, we use an ApplicationWindow to create the main application
+ window:
+
+ \quotefromfile wearable/wearable.qml
+ \skipto import "qml/Common"
+ \printuntil visible
+
+ This ApplicationWindow embeds a container that uses StackView for holding
+ the launch screen for sub-apps. \c LauncherMain is an initial item on
+ the stack view that represents Launcher sub-app. This \c MainContainer also
+ has functionality to navigate back to home screen which is enabled when
+ additional app screens are loaded in the StackView
+
+ \quotefromfile wearable/qml/MainContainer.qml
+ \skipto QQC2.StackView {
+ \printuntil initialItem: LauncherMain {
+
+ In LauncherMain, we use a ListModel type with \l ListElement types defined
+ explicitly to hold information about the sub-apps:
+ List elements are defined like other QML types except that they contain a
+ collection of \e role definitions instead of properties. Roles define both
+ how the data is accessed and include the data itself. For each list element,
+ we use the \c icon role to specify the launch icon for the feature.
+
+ \quotefromfile wearable/qml/LauncherMain.qml
+ \skipto ListModel
+ \printuntil page: "Settings/SettingsMain.qml"
+ \printuntil }
+
+ \section1 Using Custom Types
+
+ In the app, we use the following custom types that are each defined in a
+ separate .qml file:
+
+ \list
+ \li \c WSlider.qml
+ \li \c WSwitch.qml
+ \endlist
+
+ In each \c .qml file that uses the custom types, we add an import statement
+ to include a directory called \e Common where the types are located:
+
+ \quotefromfile wearable/qml/Settings/SettingsMain.qml
+ \skipto Common
+ \printuntil "
+
+ \section1 Main Screens for Sub-apps
+
+ In the demo, we use the following custom screen types that are each
+ defined in a separate .qml file:
+
+ \list
+ \li \c AlarmsMain.qml
+ \li \c FitnessMain.qml
+ \li \c NavigationMain.qml
+ \li \c NotificationsMain.qml
+ \li \c SettingsMain.qml
+ \li \c WatchFaceMain.qml
+ \li \c WeatherMain.qml
+ \li \c LauncherMain.qml
+ \endlist
+
+ Each sub-app also has its own JavaScript functions file that contains
+ routines to help acquire data to be displayed on the screen. It also
+ contains functions to help manipulate or convert the data. In some sub-apps
+ data acquisition is implemented using XMLHttpRequest to read from local
+ files. These files were generated by storing responses from remote servers
+ in JSON format. This code can be easily modified to acquire data from remote
+ servers.
+ Sub-apps are implemented with an assumption of lack of any input capabilities
+ of the device and they can be further enhanced based on what input methods
+ or communication means are offered by the wearable device under consideration.
+ Sub-apps use SwipeView as a container to display a set of pages within the
+ app.
+
+ \section1 Navigation App
+
+ This sub-app displays a walking route from source to destination. This route
+ is obtained as a response by invoking an API provided by
+ \l {http://www.openstreetmap.org/}. The response is in JSON format and the
+ corresponding JavaScript file associated with the app helps interpret the
+ response. Currently, it is not possible to specify the source and destination
+ from within the app but it can be easily added based on the device's
+ capabilities. For example, user input could be implemented as screens with
+ input fields, or can be communicated over Bluetooth/Wifi from a paired app
+ running on another device such as a smart phone or PC.
+
+ \section1 Weather App
+
+ This sub-app displays weather information for a day including temperature,
+ sunrise-sunset info, air pressure, and so on. This information is obtained
+ as a response to invoking \l {https://openweathermap.org/}. The response is
+ in JSON format and the corresponding JavaScript file associated
+ with the app helps interpret the response. As with the Navigation sub-app
+ this app can be modified by adding screens to accept location information to
+ obtain weather data for a given location.
+
+ \section1 WatchFace App
+
+ This sub-app displays a world clock for different cities. As of now, the list
+ of cities is hard-coded in the app but that can be changed based on the
+ input capabilities of the device.
+
+ \section1 Other Sub-apps
+
+ Remaining sub-apps are implemented to return static data for now but they
+ can be easily modified to process response data obtained from respective
+ services.
+
+ \include examples-run.qdocinc
+*/
diff --git a/examples/quickcontrols2/wearable/images/back.png b/examples/quickcontrols2/wearable/images/back.png
new file mode 100644
index 00000000..153162e7
--- /dev/null
+++ b/examples/quickcontrols2/wearable/images/back.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/images/background.png b/examples/quickcontrols2/wearable/images/background.png
new file mode 100644
index 00000000..1c6920e6
--- /dev/null
+++ b/examples/quickcontrols2/wearable/images/background.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/images/home.png b/examples/quickcontrols2/wearable/images/home.png
new file mode 100644
index 00000000..0d02f696
--- /dev/null
+++ b/examples/quickcontrols2/wearable/images/home.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
new file mode 100644
index 00000000..e07908ee
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.0 as QQC2
+import "../Style"
+
+Item {
+ QQC2.SwipeView {
+ id: svAlarmsContainer
+
+ anchors.fill: parent
+
+ Repeater {
+ model: ListModel {
+ ListElement { name: qsTr("Week Days"); state: true; time: "06:00 AM" }
+ ListElement { name: qsTr("Week Ends"); state: false; time: "07:30 AM" }
+ }
+
+ Item {
+ Column {
+ spacing: 30
+ anchors.centerIn: parent
+
+ QQC2.Switch {
+ id: stateSwitch
+ checked: model.state
+ anchors.left: nameLabel.right
+ }
+
+ Text {
+ text: model.time
+ anchors.horizontalCenter: parent.horizontalCenter
+ verticalAlignment: Text.AlignVCenter
+ height: UIStyle.fontSizeXL
+ font.bold: stateSwitch.checked
+ font.pixelSize: stateSwitch.checked ? UIStyle.fontSizeXL : UIStyle.fontSizeL
+ font.letterSpacing: 4
+ color: UIStyle.colorQtGray1
+ }
+
+ Text {
+ id: nameLabel
+ text: model.name
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: UIStyle.fontSizeS
+ font.italic: true
+ font.bold: true
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray2
+ }
+ }
+ }
+ }
+ }
+
+ QQC2.PageIndicator {
+ count: svAlarmsContainer.count
+ currentIndex: svAlarmsContainer.currentIndex
+
+ anchors.bottom: svAlarmsContainer.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/Alarms/images/alarms.png b/examples/quickcontrols2/wearable/qml/Alarms/images/alarms.png
new file mode 100644
index 00000000..00ec663e
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Alarms/images/alarms.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml b/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
new file mode 100644
index 00000000..b3b0a0c5
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.0 as QQ2
+import "../Style"
+import "fitness.js" as FitnessData
+
+Item {
+ QQ2.SwipeView {
+ id: svFitnessContainer
+
+ anchors.fill: parent
+
+ Item {
+ id: fitnessPage1
+
+ Column {
+ anchors.centerIn: parent
+ spacing: 15
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Steps: ") + FitnessData.getSteps()
+ font.italic: true
+ font.pixelSize: UIStyle.fontSizeM
+ color: UIStyle.colorQtGray1
+ }
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter
+ source: "images/man-walking.png"
+ }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Calories: ") + FitnessData.getCalories()
+ font.pixelSize: UIStyle.fontSizeS
+ font.italic: true
+ color: UIStyle.colorQtGray3
+ }
+ }
+ }
+
+ Item {
+ id: fitnessPage2
+
+ Column {
+ anchors.centerIn: parent
+ spacing: 15
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Distance: ")
+ + FitnessData.getDistance()
+ + qsTr(" miles")
+ font.italic: true
+ font.pixelSize: UIStyle.fontSizeM
+ color: UIStyle.colorQtGray1
+ }
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter
+ source: "images/man-running.png"
+ }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Time: ")
+ + FitnessData.getTime()
+ + qsTr(" mins")
+ font.pixelSize: UIStyle.fontSizeS
+ font.italic: true
+ color: UIStyle.colorQtGray3
+ }
+ }
+ }
+ }
+
+ QQ2.PageIndicator {
+ count: svFitnessContainer.count
+ currentIndex: svFitnessContainer.currentIndex
+
+ anchors.bottom: svFitnessContainer.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/fitness.js b/examples/quickcontrols2/wearable/qml/Fitness/fitness.js
new file mode 100644
index 00000000..7e159e2a
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Fitness/fitness.js
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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$
+**
+****************************************************************************/
+
+function getSteps() {
+ return 105;
+}
+
+function getCalories() {
+ return 150;
+}
+
+function getDistance() {
+ return 10;
+}
+
+function getTime() {
+ return "00:30";
+}
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/fitness.png b/examples/quickcontrols2/wearable/qml/Fitness/images/fitness.png
new file mode 100644
index 00000000..a8789a61
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/fitness.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-running.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running.png
new file mode 100644
index 00000000..5efab6e2
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking.png
new file mode 100644
index 00000000..01add534
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/LauncherPage.qml b/examples/quickcontrols2/wearable/qml/LauncherPage.qml
new file mode 100644
index 00000000..6ff118df
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/LauncherPage.qml
@@ -0,0 +1,192 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.0 as QQC2
+import "Style"
+
+PathView {
+ id: circularView
+
+ signal launched(string page)
+
+ readonly property int cX: width / 2
+ readonly property int cY: height / 2
+ readonly property int itemSize: size / 4
+ readonly property int size: Math.min(width - 80, height)
+ readonly property int radius: size / 2 - itemSize / 3
+
+ snapMode: PathView.SnapToItem
+
+ model: ListModel {
+ ListElement {
+ title: qsTr("World Clock")
+ icon: "WorldClock/images/watch.png"
+ page: "WorldClock/WorldClockPage.qml"
+ }
+ ListElement {
+ title: qsTr("Navigation")
+ icon: "Navigation/images/route.png"
+ page: "Navigation/NavigationPage.qml"
+ }
+ ListElement {
+ title: qsTr("Weather")
+ icon: "Weather/images/weather.png"
+ page: "Weather/WeatherPage.qml"
+ }
+ ListElement {
+ title: qsTr("Fitness")
+ icon: "Fitness/images/fitness.png"
+ page: "Fitness/FitnessPage.qml"
+ }
+ ListElement {
+ title: qsTr("Notifications")
+ icon: "Notifications/images/notifications.png"
+ page: "Notifications/NotificationsPage.qml"
+ }
+ ListElement {
+ title: qsTr("Alarm")
+ icon: "Alarms/images/alarms.png"
+ page: "Alarms/AlarmsPage.qml"
+ }
+ ListElement {
+ title: qsTr("Settings")
+ icon: "Settings/images/settings.png"
+ page: "Settings/SettingsPage.qml"
+ }
+ }
+
+ delegate: QQC2.AbstractButton {
+ text: model.title
+ opacity: PathView.itemOpacity
+
+ contentItem: Image {
+ source: model.icon
+ fillMode: Image.Pad
+ sourceSize.width: circularView.itemSize
+ sourceSize.height: circularView.itemSize
+ }
+
+ background: Rectangle {
+ radius: width / 2
+ color: "transparent"
+
+ border.width: 3
+ border.color: parent.PathView.isCurrentItem ?
+ "transparent"
+ : UIStyle.colorQtGray4
+ }
+
+ onClicked: {
+ if (PathView.isCurrentItem)
+ circularView.launched(Qt.resolvedUrl(page))
+ else
+ circularView.currentIndex = index
+ }
+ }
+
+ path: Path {
+ startX: circularView.cX
+ startY: circularView.cY
+ PathAttribute {
+ name: "itemOpacity"
+ value: 1.0
+ }
+ PathLine {
+ x: circularView.cX + circularView.radius
+ y: circularView.cY
+ }
+ PathAttribute {
+ name: "itemOpacity"
+ value: 0.7
+ }
+ PathArc {
+ x: circularView.cX - circularView.radius
+ y: circularView.cY
+ radiusX: circularView.radius
+ radiusY: circularView.radius
+ useLargeArc: true
+ direction: PathArc.Clockwise
+ }
+ PathAttribute {
+ name: "itemOpacity"
+ value: 0.5
+ }
+ PathArc {
+ x: circularView.cX + circularView.radius
+ y: circularView.cY
+ radiusX: circularView.radius
+ radiusY: circularView.radius
+ useLargeArc: true
+ direction: PathArc.Clockwise
+ }
+ PathAttribute {
+ name: "itemOpacity"
+ value: 0.3
+ }
+ }
+
+ Text {
+ id: appTitle
+
+ property Item currentItem: circularView.currentItem
+
+ visible: currentItem ? currentItem.PathView.itemOpacity === 1.0 : 0
+
+ text: currentItem ? currentItem.text : ""
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: (circularView.itemSize + height) / 2
+
+ font.bold: true
+ font.pixelSize: circularView.itemSize / 3
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/NaviButton.qml b/examples/quickcontrols2/wearable/qml/NaviButton.qml
new file mode 100644
index 00000000..7a8f7c14
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/NaviButton.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.0 as QQC2
+import "Style"
+
+QQC2.AbstractButton {
+ id: button
+
+ property int edge: Qt.TopEdge
+ property alias imageSource: image.source
+
+ contentItem: Image {
+ id: image
+ fillMode: Image.Pad
+ sourceSize { width: 40; height: 40 } // ### TODO: resize the image
+ }
+
+ background: Rectangle {
+ height: button.height * 4
+ width: height
+ radius: width / 2
+
+ anchors.horizontalCenter: button.horizontalCenter
+ anchors.top: edge === Qt.BottomEdge ? button.top : undefined
+ anchors.bottom: edge === Qt.TopEdge ? button.bottom : undefined
+
+ color: UIStyle.colorQtGray2
+ }
+
+ transform: Translate {
+ Behavior on y { NumberAnimation { } }
+ y: enabled ? 0 : edge === Qt.TopEdge ? -button.height : button.height
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
new file mode 100644
index 00000000..bdc3e494
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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 "../Style"
+import "navigation.js" as NavigationData
+
+Item {
+ Column {
+ anchors.fill: parent
+ anchors.margins: 2
+ spacing: 2
+
+ Rectangle {
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: parent.width
+ height: titleRow.height
+
+ color: UIStyle.colorQtGray9
+
+ Row {
+ id: titleRow
+ spacing: 10
+ anchors.centerIn: parent
+
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/route.png"
+ fillMode: Image.PreserveAspectCrop
+ }
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: qsTr("Walking")
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 2
+ color: UIStyle.colorQtGray2
+ }
+ }
+ }
+
+ ListModel {
+ id: routeModel
+ }
+
+ ListView {
+ id: routeView
+
+ width: parent.width
+ height: parent.height - titleRow.height - parent.spacing
+ property var imageList: ["straight.png",
+ "leftturn.png",
+ "rightturn.png",
+ "uturn.png",
+ "start.png",
+ "end.png"]
+
+ clip: true
+ focus: true
+ boundsBehavior: Flickable.StopAtBounds
+ snapMode: ListView.SnapToItem
+ model: routeModel
+ delegate: RouteElement {
+ width: routeView.width
+ height: routeView.height
+ }
+ }
+ }
+ Component.onCompleted: {
+ NavigationData.requestNavigationRoute(routeModel)
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml b/examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml
new file mode 100644
index 00000000..79928012
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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 "../Style"
+
+Rectangle {
+ color: UIStyle.colorQtGray8
+
+ Row {
+ spacing: 5
+ width: parent.width - 80
+ anchors.centerIn: parent
+
+ Image {
+ id: img
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/" + navImage
+ fillMode: Image.PreserveAspectFit
+ }
+
+ Column {
+ spacing: 5
+ width: parent.width - img.width
+ anchors.verticalCenter: parent.verticalCenter
+
+ Text {
+ width: parent.width
+ wrapMode: Text.WordWrap
+ text: navInstruction
+ font.pixelSize: UIStyle.fontSizeS
+ verticalAlignment: Text.AlignVCenter
+ padding: 1
+ color: UIStyle.colorQtGray1
+ }
+
+ Text {
+ width: parent.width
+ wrapMode: Text.WordWrap
+ text: navAuxInfo
+ font.pixelSize: UIStyle.fontSizeXS
+ verticalAlignment: Text.AlignVCenter
+ padding: 1
+ color: UIStyle.colorQtGray2
+ }
+ }
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/end.png b/examples/quickcontrols2/wearable/qml/Navigation/images/end.png
new file mode 100644
index 00000000..3006c0f3
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/end.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn.png b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn.png
new file mode 100644
index 00000000..3c416304
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/marker.png b/examples/quickcontrols2/wearable/qml/Navigation/images/marker.png
new file mode 100644
index 00000000..3006c0f3
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/marker.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn.png b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn.png
new file mode 100644
index 00000000..a29ec694
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/route.png b/examples/quickcontrols2/wearable/qml/Navigation/images/route.png
new file mode 100644
index 00000000..b8ac9d7e
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/route.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/start.png b/examples/quickcontrols2/wearable/qml/Navigation/images/start.png
new file mode 100644
index 00000000..1adf0ac8
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/start.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/straight.png b/examples/quickcontrols2/wearable/qml/Navigation/images/straight.png
new file mode 100644
index 00000000..e3c5bb5c
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/straight.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/uturn.png b/examples/quickcontrols2/wearable/qml/Navigation/images/uturn.png
new file mode 100644
index 00000000..b6917f67
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/uturn.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/navigation.js b/examples/quickcontrols2/wearable/qml/Navigation/navigation.js
new file mode 100644
index 00000000..0414731d
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/navigation.js
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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$
+**
+****************************************************************************/
+
+function requestNavigationRoute(rModel) {
+ var xhr = new XMLHttpRequest;
+ xhr.open("GET", "walk_route.json");
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ var a = JSON.parse(xhr.responseText);
+ var steps = a.routes[0].legs[0].steps;
+
+ for (var step in steps) {
+ var maneuver = steps[step].maneuver;
+ var duration = steps[step].duration;
+ var distance = steps[step].distance;
+
+ rModel.append({
+ navInstruction: maneuver.instruction,
+ navImage: getNavigationImage(
+ maneuver.type,
+ maneuver.modifier,
+ routeView.imageList),
+ navAuxInfo: getAuxInfo(distance,
+ duration)
+ });
+ }
+ }
+ }
+ xhr.send();
+}
+
+function getNavigationImage(maneuverType, maneuverModifier, imageList) {
+ var imageToReturn;
+ if (maneuverType === "depart") {
+ imageToReturn = imageList[4];
+ } else if (maneuverType === "arrive") {
+ imageToReturn = imageList[5];
+ } else if (maneuverType === "turn") {
+ if (maneuverModifier.search("left") >= 0)
+ imageToReturn = imageList[1];
+ else if (maneuverModifier.search("right") >= 0)
+ imageToReturn = imageList[2];
+ else
+ imageToReturn = imageList[0];
+ } else {
+ if (maneuverModifier === "uturn") {
+ imageToReturn = imageList[3];
+ } else {
+ imageToReturn = imageList[0];
+ }
+ }
+
+ return imageToReturn;
+}
+
+function getAuxInfo(distInMeters, timeInSecs) {
+ var distance = convertDistance(distInMeters);
+ if (distance.length > 0)
+ return "Distance: " + distance + "\nTime: " + formatSeconds(
+ timeInSecs);
+ else
+ return "";
+}
+
+function convertDistance(meter) {
+ var dist = "";
+ var feet = (meter * 0.3048).toPrecision(6);
+ var miles = (meter * 0.000621371).toPrecision(6);
+
+ if (Math.floor(miles) > 1) {
+ dist += Math.floor(miles) + " mi";
+ feet = ((miles - Math.floor(miles)) * 0.3048).toPrecision(6);
+ }
+ if (Math.floor(feet) > 1)
+ dist += Math.floor(feet) + " ft";
+
+ return dist
+}
+
+function formatSeconds(seconds) {
+ var date = new Date(1970, 0, 1);
+ date.setSeconds(seconds);
+ return date.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");
+}
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/walk_route.json b/examples/quickcontrols2/wearable/qml/Navigation/walk_route.json
new file mode 100644
index 00000000..e69b5cc1
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/walk_route.json
@@ -0,0 +1 @@
+{"routes":[{"legs":[{"steps":[{"intersections":[{"out":0,"entry":[true],"bearings":[144],"location":[-122.394553,37.795984]},{"out":1,"location":[-122.393896,37.795268],"bearings":[60,150,225,330],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.393179,37.79453],"bearings":[60,135,180,225,315],"entry":[true,true,true,true,false],"in":4},{"out":1,"location":[-122.393072,37.79443],"bearings":[45,135,225,315],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.392787,37.79415],"bearings":[60,135,315],"entry":[true,true,false],"in":2},{"out":1,"location":[-122.392537,37.793915],"bearings":[45,135,225,315],"entry":[true,true,true,false],"in":3},{"out":0,"location":[-122.392448,37.793831],"bearings":[135,225,315],"entry":[true,true,false],"in":2}],"geometry":"{_ueF|d`jVRQdB}ARQh@g@XUVWVW^a@RUv@w@l@q@PQNQ","maneuver":{"bearing_after":144,"location":[-122.394553,37.795984],"bearing_before":0,"type":"depart","instruction":"Head southeast on The Embarcadero"},"duration":230.8,"distance":314.8,"name":"The Embarcadero","mode":"walking"},{"intersections":[{"out":2,"location":[-122.392361,37.793748],"bearings":[45,135,225,315],"entry":[true,true,true,false],"in":3}],"geometry":"}qteFfw_jVHJBDHJ","maneuver":{"bearing_after":225,"type":"turn","modifier":"right","bearing_before":140,"location":[-122.392361,37.793748],"instruction":"Turn right"},"duration":13.2,"distance":18.5,"name":"","mode":"walking"},{"intersections":[{"out":1,"location":[-122.39251,37.793631],"bearings":[45,135,225,315],"entry":[false,true,true,true],"in":0},{"out":1,"location":[-122.391284,37.792459],"bearings":[45,150,225,330],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.391217,37.792342],"bearings":[45,165,225,330],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.391165,37.792231],"bearings":[45,165,225,345],"entry":[true,true,true,false],"in":3},{"out":0,"location":[-122.390884,37.791536],"bearings":[150,285,345],"entry":[true,true,false],"in":2},{"out":1,"location":[-122.390254,37.790827],"bearings":[45,135,210,315],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.390144,37.790745],"bearings":[45,135,225,315],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.390038,37.790665],"bearings":[45,135,240,315],"entry":[true,true,true,false],"in":3},{"out":0,"location":[-122.389245,37.790036],"bearings":[135,225,315],"entry":[true,true,false],"in":2},{"out":1,"location":[-122.38871,37.789596],"bearings":[45,150,210,315],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.388618,37.789494],"bearings":[45,150,225,330],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.388527,37.789394],"bearings":[45,150,225,330],"entry":[true,true,true,false],"in":3},{"out":1,"location":[-122.388005,37.787907],"bearings":[0,180,270],"entry":[false,true,true],"in":0},{"out":1,"location":[-122.387985,37.787622],"bearings":[0,180,240],"entry":[false,true,true],"in":0},{"out":2,"location":[-122.388005,37.787197],"bearings":[0,90,180,270],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.388015,37.787093],"bearings":[0,90,180,270],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.388022,37.786994],"bearings":[0,90,180,285],"entry":[false,true,true,true],"in":0},{"out":1,"location":[-122.388163,37.785186],"bearings":[0,180,315],"entry":[false,true,true],"in":0},{"out":1,"location":[-122.388184,37.784944],"bearings":[0,180,315],"entry":[false,true,true],"in":0},{"out":2,"location":[-122.388191,37.784855],"bearings":[0,90,180,270],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.388198,37.784748],"bearings":[0,90,180,270],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.388207,37.784633],"bearings":[0,90,180,270],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.388309,37.783373],"bearings":[0,60,180,270],"entry":[false,true,true,true],"in":0},{"out":1,"location":[-122.388376,37.782545],"bearings":[0,180,315],"entry":[false,true,true],"in":0},{"out":1,"location":[-122.388394,37.782316],"bearings":[0,180,315],"entry":[false,true,true],"in":0}],"geometry":"eqteFdx_jVf@k@\\a@|@iAV[FGJMPOTOPKDAPITItAa@r@WXOXQXSTUTWRYNUNS|B}CdAwAPSTQRQ\\W^Q\\KZIrB]^EPCH?\\CZ?Z?\\?XBT@R?~IZF?H@f@@N@T@V@zFRbDLl@@pADV@","maneuver":{"bearing_after":139,"type":"turn","modifier":"left","bearing_before":226,"location":[-122.39251,37.793631],"instruction":"Turn left onto The Embarcadero"},"duration":1055.9,"distance":1450.3,"name":"The Embarcadero","mode":"walking"},{"intersections":[{"out":2,"location":[-122.388431,37.781791],"bearings":[0,90,180,285],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.389672,37.779922],"bearings":[45,135,225,315],"entry":[false,true,true,true],"in":0},{"out":1,"location":[-122.390803,37.77905],"bearings":[45,225,315],"entry":[false,true,true],"in":0},{"out":2,"location":[-122.391916,37.778155],"bearings":[45,135,225,315],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.393073,37.777251],"bearings":[45,75,225,315],"entry":[false,true,true,true],"in":0}],"geometry":"egreFt~~iVR@bABXDVDXHVNXNXVVZp@|@z@hAnCvDLRNTHLFJbArAzApBdB`CTZZb@\\b@@@pCvD","maneuver":{"bearing_after":183,"type":"new name","modifier":"straight","bearing_before":183,"location":[-122.388431,37.781791],"instruction":"Continue straight onto King Street"},"duration":567.4,"distance":782.5,"name":"King Street","mode":"walking"},{"intersections":[{"out":3,"location":[-122.394003,37.776513],"bearings":[45,135,225,300],"entry":[false,true,true,true],"in":0},{"out":2,"location":[-122.394218,37.776486],"bearings":[45,135,225,315],"entry":[false,true,true,true],"in":0}],"geometry":"efqeFna`jVGJ?NJNNR","maneuver":{"bearing_after":313,"type":"turn","modifier":"straight","bearing_before":225,"location":[-122.394003,37.776513],"instruction":"Go straight"},"duration":26.1,"distance":36.2,"name":"","mode":"walking"},{"intersections":[{"out":2,"location":[-122.394321,37.776405],"bearings":[45,180,315],"entry":[false,true,true],"in":0},{"out":1,"location":[-122.394729,37.776487],"bearings":[45,180],"entry":[false,true],"in":0}],"geometry":"qeqeFnc`jVe@p@A@V\\DF","maneuver":{"bearing_after":315,"type":"turn","modifier":"right","bearing_before":225,"location":[-122.394321,37.776405],"instruction":"Turn right"},"duration":39.9,"distance":55.6,"name":"","mode":"walking"},{"intersections":[{"in":0,"entry":[true],"bearings":[45],"location":[-122.394768,37.776455]}],"geometry":"{eqeFhf`jV","maneuver":{"bearing_after":0,"type":"arrive","modifier":"straight","bearing_before":225,"location":[-122.394729,37.776487],"instruction":"You have arrived at your destination, straight ahead"},"duration":0,"distance":0,"name":"","mode":"walking"}],"summary":"The Embarcadero, King Street","duration":1933.3,"distance":2657.8}],"geometry":"{_ueF|d`jV|LuLV\\`EyElHaD~I_LvB_AdGk@he@|AbBd@bZl`@R~@g@r@\\d@","duration":1933.3,"distance":2657.8}],"waypoints":[{"name":"The Embarcadero","location":[-122.394553,37.795984]},{"name":"","location":[-122.394768,37.776455]}],"code":"Ok"}
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml b/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml
new file mode 100644
index 00000000..d5bec2f8
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.0 as QQC2
+import "../Style"
+import "notifications.js" as NotificationData
+
+ListView {
+ id: missedCallsView
+
+ clip: true
+ focus: true
+ boundsBehavior: Flickable.StopAtBounds
+ snapMode: ListView.SnapToItem
+
+ model: ListModel {
+ id: missedCallsList
+ }
+
+ Image {
+ id: missedCallIcon
+ width: parent.width / 2
+ anchors.right: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/missedcall.png"
+ fillMode: Image.Pad
+ }
+
+ delegate: Item {
+ height: missedCallsView.height
+ width: missedCallsView.width / 2
+ anchors.left: parent.horizontalCenter
+
+ Column {
+ spacing: 15
+ anchors.verticalCenter: parent.verticalCenter
+
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter
+ source: qsTr("images/avatar%1.png").arg(model.gender)
+ }
+
+ Text {
+ text: model.name
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.bold: true
+ font.pixelSize: UIStyle.fontSizeS
+ color: UIStyle.colorQtGray1
+ }
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: date + " " + time
+ font.pixelSize: UIStyle.fontSizeXS
+ font.italic: true
+ color: UIStyle.colorQtGray2
+ }
+ }
+ }
+
+ Component.onCompleted: {
+ NotificationData.populateData(missedCallsList)
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf.png
new file mode 100644
index 00000000..c88edc60
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm.png
new file mode 100644
index 00000000..f7abb4c9
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall.png b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall.png
new file mode 100644
index 00000000..d05f17b3
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/notifications.png b/examples/quickcontrols2/wearable/qml/Notifications/images/notifications.png
new file mode 100644
index 00000000..c5c3ffb2
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/notifications.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/notifications.js b/examples/quickcontrols2/wearable/qml/Notifications/notifications.js
new file mode 100644
index 00000000..8716c56f
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/notifications.js
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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$
+**
+****************************************************************************/
+
+function populateData(listData) {
+ listData.append({
+ name: "John Doe",
+ gender: "m",
+ date: "02/15/2017",
+ time: "09:20 am"
+ });
+
+ listData.append({
+ name: "Jane Worldege",
+ gender: "f",
+ date: "02/06/2017",
+ time: "10:15 am"
+ });
+
+ listData.append({
+ name: "Jennifer Wang",
+ gender: "f",
+ date: "02/03/2017",
+ time: "05:16 pm"
+ });
+}
diff --git a/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml b/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml
new file mode 100644
index 00000000..48f3a3d6
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.0 as QQC2
+import Qt.labs.settings 1.0
+import "../Style"
+
+Item {
+
+ Settings {
+ id: settings
+ property alias wireless: wirelessSwitch.checked
+ property alias bluetooth: bluetoothSwitch.checked
+ property alias contrast: contrastSlider.value
+ property alias brightness: brightnessSlider.value
+ }
+
+ QQC2.SwipeView {
+ id: svSettingsContainer
+
+ anchors.fill: parent
+
+ Item {
+ id: settingsPage1
+
+ Column {
+ anchors.centerIn: parent
+ spacing: 25
+
+ Row {
+ spacing: 50
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/bluetooth.png"
+ }
+ QQC2.Switch {
+ id: bluetoothSwitch
+ anchors.verticalCenter: parent.verticalCenter
+ checked: settings.bluetooth
+ }
+ }
+ Row {
+ spacing: 50
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/wifi.png"
+ }
+ QQC2.Switch {
+ id: wirelessSwitch
+ anchors.verticalCenter: parent.verticalCenter
+ checked: settings.wireless
+ }
+ }
+ }
+ }
+
+ Item {
+ id: settingsPage2
+
+ Column {
+ anchors.centerIn: parent
+ spacing: 2
+
+ Column {
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter
+ source: "images/brightness.png"
+ }
+ QQC2.Slider {
+ id: brightnessSlider
+ anchors.horizontalCenter: parent.horizontalCenter
+ from: 0
+ to: 5
+ stepSize: 1
+ value: settings.brightness
+ }
+ }
+ Column {
+ spacing: 2
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter
+ source: "images/contrast.png"
+ }
+ QQC2.Slider {
+ id: contrastSlider
+ anchors.horizontalCenter: parent.horizontalCenter
+ from: 0
+ to: 10
+ stepSize: 1
+ value: settings.contrast
+ }
+ }
+ }
+ }
+ }
+
+ QQC2.PageIndicator {
+ count: svSettingsContainer.count
+ currentIndex: svSettingsContainer.currentIndex
+
+ anchors.bottom: svSettingsContainer.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth.png b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth.png
new file mode 100644
index 00000000..2b2d0e7e
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/brightness.png b/examples/quickcontrols2/wearable/qml/Settings/images/brightness.png
new file mode 100644
index 00000000..846a896c
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/brightness.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/contrast.png b/examples/quickcontrols2/wearable/qml/Settings/images/contrast.png
new file mode 100644
index 00000000..eb528eb8
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/contrast.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/settings.png b/examples/quickcontrols2/wearable/qml/Settings/images/settings.png
new file mode 100644
index 00000000..c42f7dc6
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/settings.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/wifi.png b/examples/quickcontrols2/wearable/qml/Settings/images/wifi.png
new file mode 100644
index 00000000..42c92516
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/wifi.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml b/examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml
new file mode 100644
index 00000000..6a92c42f
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.Templates 2.0 as T
+import "."
+
+T.PageIndicator {
+ id: control
+
+ implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
+ implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
+
+ spacing: 6
+ padding: 6
+ bottomPadding: 7
+
+ delegate: Rectangle {
+ implicitWidth: 8
+ implicitHeight: 8
+
+ radius: width / 2
+ color: UIStyle.colorQtGray3
+
+ opacity: index === control.currentIndex ? 1.0 : 0.35
+
+ Behavior on opacity {
+ OpacityAnimator {
+ duration: 100
+ }
+ }
+ }
+
+ contentItem: Row {
+ spacing: control.spacing
+
+ Repeater {
+ model: control.count
+ delegate: control.delegate
+ }
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/Style/Slider.qml b/examples/quickcontrols2/wearable/qml/Style/Slider.qml
new file mode 100644
index 00000000..86f28abe
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Style/Slider.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.Templates 2.0 as T
+import "."
+
+T.Slider {
+ id: control
+
+ implicitWidth: 200
+ implicitHeight: 26
+
+ handle: Rectangle {
+ x: control.visualPosition * (control.width - width)
+ y: (control.height - height) / 2
+ width: 20
+ height: 15
+
+ radius: 5
+ color: control.pressed ? "#f0f0f0" : "#f6f6f6"
+ border.color: UIStyle.colorQtGray7
+ }
+
+ background: Rectangle {
+ y: (control.height - height) / 2
+ height: 4
+ radius: 2
+ color: UIStyle.colorQtGray3
+
+ Rectangle {
+ width: control.visualPosition * parent.width
+ height: parent.height
+ color: UIStyle.colorQtAuxGreen2
+ radius: 2
+ }
+ }
+}
+
diff --git a/examples/quickcontrols2/wearable/qml/Style/Switch.qml b/examples/quickcontrols2/wearable/qml/Style/Switch.qml
new file mode 100644
index 00000000..a1dad07a
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Style/Switch.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.Templates 2.0 as T
+import "."
+
+T.Switch {
+ id: control
+
+ implicitWidth: 48
+ implicitHeight: 26
+
+ indicator: Rectangle {
+ x: control.visualPosition * (control.width - width)
+ y: (control.height - height) / 2
+ width: 26
+ height: 26
+
+ radius: 13
+ color: control.down ? UIStyle.colorQtGray6 : UIStyle.colorQtGray10
+ border.color: !control.checked ? "#999999"
+ : (control.down ? UIStyle.colorQtAuxGreen2
+ : UIStyle.colorQtAuxGreen1)
+
+ Behavior on x {
+ enabled: !control.pressed
+ SmoothedAnimation { velocity: 200 }
+ }
+ }
+
+ background: Rectangle {
+ radius: 13
+ color: control.checked ? UIStyle.colorQtAuxGreen2 : "#E6173D"
+ border.color: control.checked ? UIStyle.colorQtAuxGreen2
+ : UIStyle.colorQtGray6
+ }
+}
+
diff --git a/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml b/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml
new file mode 100644
index 00000000..98971233
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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
+
+pragma Singleton
+
+QtObject {
+ id: uiStyle
+
+ // Font Sizes
+ readonly property int fontSizeXXS: 10
+ readonly property int fontSizeXS: 15
+ readonly property int fontSizeS: 20
+ readonly property int fontSizeM: 25
+ readonly property int fontSizeL: 30
+ readonly property int fontSizeXL: 35
+ readonly property int fontSizeXXL: 40
+
+ // Color Scheme
+ // Green
+ readonly property color colorQtPrimGreen: "#41cd52"
+ readonly property color colorQtAuxGreen1: "#21be2b"
+ readonly property color colorQtAuxGreen2: "#17a81a"
+
+ // Gray
+ readonly property color colorQtGray1: "#09102b"
+ readonly property color colorQtGray2: "#222840"
+ readonly property color colorQtGray3: "#3a4055"
+ readonly property color colorQtGray4: "#53586b"
+ readonly property color colorQtGray5: "#53586b"
+ readonly property color colorQtGray6: "#848895"
+ readonly property color colorQtGray7: "#9d9faa"
+ readonly property color colorQtGray8: "#b5b7bf"
+ readonly property color colorQtGray9: "#cecfd5"
+ readonly property color colorQtGray10: "#f3f3f4"
+}
diff --git a/examples/quickcontrols2/wearable/qml/Style/qmldir b/examples/quickcontrols2/wearable/qml/Style/qmldir
new file mode 100644
index 00000000..a04072be
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Style/qmldir
@@ -0,0 +1 @@
+singleton UIStyle 1.0 UIStyle.qml
diff --git a/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml b/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
new file mode 100644
index 00000000..2ef0133c
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
@@ -0,0 +1,296 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.0 as QQC2
+import "../Style"
+import "weather.js" as WeatherData
+
+Item {
+ QQC2.SwipeView {
+ id: svWeatherContainer
+
+ anchors.fill: parent
+
+ Item {
+ id: weatherPage1
+
+ Row {
+ anchors.centerIn: parent
+ spacing: 2
+
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/temperature.png"
+ }
+
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+ spacing: 40
+
+ Text {
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.temp) ?
+ qsTr("Avg: ")
+ + String(wDataCntr.weatherData.main.temp)
+ + " °F" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+
+ Text {
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.temp_min) ?
+ qsTr("Min: ")
+ + String(wDataCntr.weatherData.main.temp_min)
+ + " °F" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+
+ Text {
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.temp_max) ?
+ qsTr("Max: ")
+ + String(wDataCntr.weatherData.main.temp_max)
+ + " °F " : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ }
+ }
+ }
+
+ Item {
+ id: weatherPage2
+
+ Column {
+ spacing: 40
+ anchors.centerIn: parent
+
+ Row {
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Image {
+ id: wImg
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/wind.png"
+ }
+
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.wind
+ && wDataCntr.weatherData.wind.speed) ?
+ String(wDataCntr.weatherData.wind.speed)
+ + " mph" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ }
+
+ Row {
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Image {
+ id: hImg
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/humidity.png"
+ }
+
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.humidity) ?
+ String(wDataCntr.weatherData.main.humidity)
+ + " %" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ }
+ }
+ }
+
+ Item {
+ id: weatherPage3
+
+ Row {
+ anchors.centerIn: parent
+ spacing: 10
+
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/pressure.png"
+ }
+
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+ spacing: 40
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.pressure) ?
+ String(wDataCntr.weatherData.main.pressure)
+ + " hPa" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.sea_level) ?
+ String(wDataCntr.weatherData.main.sea_level)
+ + " hPa" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.grnd_level) ?
+ String(wDataCntr.weatherData.main.grnd_level)
+ + " hPa" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ }
+ }
+ }
+
+ Item {
+ id: weatherPage4
+
+ Column {
+ spacing: 40
+ anchors.centerIn: parent
+
+ Row {
+ spacing: 30
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/sunrise.png"
+ }
+
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.sys
+ && wDataCntr.weatherData.sys.sunrise) ?
+ WeatherData.getTimeHMS(wDataCntr.weatherData.sys.sunrise)
+ : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ }
+
+ Row {
+ spacing: 30
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/sunset.png"
+ }
+
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.sys
+ && wDataCntr.weatherData.sys.sunset) ?
+ WeatherData.getTimeHMS(wDataCntr.weatherData.sys.sunset)
+ : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ }
+ }
+ }
+ }
+
+ QtObject {
+ id: wDataCntr
+ property var weatherData
+ }
+
+ QQC2.PageIndicator {
+ count: svWeatherContainer.count
+ currentIndex: svWeatherContainer.currentIndex
+
+ anchors.bottom: svWeatherContainer.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Component.onCompleted: {
+ WeatherData.requestWeatherData(wDataCntr)
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/humidity.png b/examples/quickcontrols2/wearable/qml/Weather/images/humidity.png
new file mode 100644
index 00000000..ef9ed9de
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/humidity.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/pressure.png b/examples/quickcontrols2/wearable/qml/Weather/images/pressure.png
new file mode 100644
index 00000000..7850609e
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/pressure.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunrise.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise.png
new file mode 100644
index 00000000..70a9a969
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunset.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunset.png
new file mode 100644
index 00000000..01bb9ec8
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunset.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/temperature.png b/examples/quickcontrols2/wearable/qml/Weather/images/temperature.png
new file mode 100644
index 00000000..5d7faa99
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/temperature.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/weather.png b/examples/quickcontrols2/wearable/qml/Weather/images/weather.png
new file mode 100644
index 00000000..0530d47b
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/weather.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/wind.png b/examples/quickcontrols2/wearable/qml/Weather/images/wind.png
new file mode 100644
index 00000000..c728fcc0
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/wind.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/weather.js b/examples/quickcontrols2/wearable/qml/Weather/weather.js
new file mode 100644
index 00000000..b3bf4465
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/weather.js
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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$
+**
+****************************************************************************/
+
+function requestWeatherData(cntr) {
+ var xhr = new XMLHttpRequest;
+ xhr.open("GET", "weather.json");
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState === XMLHttpRequest.DONE) {
+ cntr.weatherData = JSON.parse(xhr.responseText)
+ }
+ }
+ xhr.send();
+}
+
+function getTimeHMS(utcTime) {
+ var date = new Date(utcTime * 1000);
+ // Hours part from the timestamp
+ var hours = date.getHours();
+ var ampm = Math.floor((hours / 12)) ? " PM" : " AM";
+ hours = (hours % 12);
+
+ // Minutes part from the timestamp
+ var minutes = "0" + date.getMinutes();
+ // Seconds part from the timestamp
+ var seconds = "0" + date.getSeconds();
+
+ // Will display time in 10:30:23 format
+ return hours % 12 + ':' + minutes.substr(-2) + ':' + seconds.substr(-2)
+ + ampm;
+}
diff --git a/examples/quickcontrols2/wearable/qml/Weather/weather.json b/examples/quickcontrols2/wearable/qml/Weather/weather.json
new file mode 100644
index 00000000..2cce95c6
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/weather.json
@@ -0,0 +1 @@
+{"coord":{"lon":-122.42,"lat":37.77},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"base":"stations","main":{"temp":45.22,"pressure":1020.17,"humidity":88,"temp_min":36.92,"temp_max":58.92,"sea_level":1028.19,"grnd_level":1020.17},"wind":{"speed":6.73,"deg":201.002},"clouds":{"all":68},"dt":1476412232,"sys":{"message":0.012,"country":"US","sunrise":1476454666,"sunset":1476495156},"id":5391959,"name":"San Francisco","cod":200}
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml b/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml
new file mode 100644
index 00000000..a6e67e8c
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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 "../Style"
+
+Item {
+ id: clock
+
+ property int hours
+ property int minutes
+ property int seconds
+ property real shift: timeShift
+ property bool night: false
+ property bool internationalTime: true //Unset for local time
+
+ function getWatchFaceImage(imageName) {
+ return "images/" + imageName
+ }
+
+ function timeChanged() {
+ var date = new Date
+ hours = internationalTime ? date.getUTCHours() + Math.floor(
+ clock.shift) : date.getHours()
+ night = (hours < 7 || hours > 19)
+ minutes = internationalTime ?
+ date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes()
+ seconds = date.getUTCSeconds()
+ }
+
+ Timer {
+ interval: 100
+ running: true
+ repeat: true
+ onTriggered: clock.timeChanged()
+ }
+
+ Item {
+ anchors.centerIn: parent
+
+ width: 200
+ height: 220
+
+ Rectangle {
+ color: clock.night ? UIStyle.colorQtGray1 : UIStyle.colorQtGray10
+ radius: width / 2
+ width: parent.width
+ height: parent.width
+ }
+
+ Image {
+ id: background
+ source: getWatchFaceImage("swissdaydial.png")
+ visible: clock.night == false
+ }
+ Image {
+ source: getWatchFaceImage("swissnightdial.png")
+ visible: clock.night == true
+ }
+
+ Image {
+ x: 92.5
+ y: 27
+ source: getWatchFaceImage(clock.night ?
+ "swissnighthour.png"
+ : "swissdayhour.png")
+ transform: Rotation {
+ id: hourRotation
+ origin.x: 7.5
+ origin.y: 73
+ angle: (clock.hours * 30) + (clock.minutes * 0.5)
+ Behavior on angle {
+ SpringAnimation {
+ spring: 2
+ damping: 0.2
+ modulus: 360
+ }
+ }
+ }
+ }
+
+ Image {
+ x: 93.5
+ y: 17
+ source: getWatchFaceImage(clock.night ?
+ "swissnightminute.png"
+ : "swissdayminute.png")
+ transform: Rotation {
+ id: minuteRotation
+ origin.x: 6.5
+ origin.y: 83
+ angle: clock.minutes * 6
+ Behavior on angle {
+ SpringAnimation {
+ spring: 2
+ damping: 0.2
+ modulus: 360
+ }
+ }
+ }
+ }
+
+ Image {
+ x: 97.5
+ y: 20
+ source: getWatchFaceImage("second.png")
+ transform: Rotation {
+ id: secondRotation
+ origin.x: 2.5
+ origin.y: 80
+ angle: clock.seconds * 6
+ Behavior on angle {
+ SpringAnimation {
+ spring: 2
+ damping: 0.2
+ modulus: 360
+ }
+ }
+ }
+ }
+
+ Image {
+ anchors.centerIn: background
+ source: getWatchFaceImage("center.png")
+ }
+
+ Text {
+ id: cityLabel
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 2
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ text: cityName
+ color: UIStyle.colorQtGray1
+ font.pixelSize: UIStyle.fontSizeXS
+ font.letterSpacing: 2
+ }
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml b/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml
new file mode 100644
index 00000000..cdf96bf2
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.0 as QQC2
+import "../Style"
+
+Item {
+ QQC2.SwipeView {
+ id: svWatchContainer
+
+ anchors.fill: parent
+
+ ListModel {
+ id: placesList
+ ListElement {
+ cityName: "New York"
+ timeShift: -4
+ }
+ ListElement {
+ cityName: "London"
+ timeShift: 0
+ }
+ ListElement {
+ cityName: "Oslo"
+ timeShift: 1
+ }
+ ListElement {
+ cityName: "Mumbai"
+ timeShift: 5.5
+ }
+ ListElement {
+ cityName: "Tokyo"
+ timeShift: 9
+ }
+ ListElement {
+ cityName: "Brisbane"
+ timeShift: 10
+ }
+ ListElement {
+ cityName: "Los Angeles"
+ timeShift: -8
+ }
+ }
+
+ Repeater {
+ model: placesList
+ delegate: Clock {
+ }
+ }
+ }
+
+ QQC2.PageIndicator {
+ count: svWatchContainer.count
+ currentIndex: svWatchContainer.currentIndex
+
+ anchors.bottom: svWatchContainer.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/center.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/center.png
new file mode 100644
index 00000000..7fbd802a
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/center.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/clock-night.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/clock-night.png
new file mode 100644
index 00000000..698f57a5
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/clock-night.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/clock.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/clock.png
new file mode 100644
index 00000000..6e1c6eed
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/clock.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/second.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/second.png
new file mode 100644
index 00000000..eee07efb
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/second.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdaydial.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdaydial.png
new file mode 100644
index 00000000..64136618
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdaydial.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayhour.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayhour.png
new file mode 100644
index 00000000..255985d2
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayhour.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayminute.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayminute.png
new file mode 100644
index 00000000..bc6992f8
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissdayminute.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightdial.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightdial.png
new file mode 100644
index 00000000..e2590af4
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightdial.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnighthour.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnighthour.png
new file mode 100644
index 00000000..1c6a6131
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnighthour.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightminute.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightminute.png
new file mode 100644
index 00000000..3353ba2c
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissnightminute.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/swissseconds.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissseconds.png
new file mode 100644
index 00000000..66b4f3fa
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/swissseconds.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/images/watch.png b/examples/quickcontrols2/wearable/qml/WorldClock/images/watch.png
new file mode 100644
index 00000000..299858b7
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/images/watch.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/wearable.cpp b/examples/quickcontrols2/wearable/wearable.cpp
new file mode 100644
index 00000000..5f96caf4
--- /dev/null
+++ b/examples/quickcontrols2/wearable/wearable.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include <QQuickStyle>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQuickStyle::setStyle(QStringLiteral("qrc:/qml/Style"));
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/wearable.qml")));
+
+ return app.exec();
+}
diff --git a/examples/quickcontrols2/wearable/wearable.pro b/examples/quickcontrols2/wearable/wearable.pro
new file mode 100644
index 00000000..8d55e44e
--- /dev/null
+++ b/examples/quickcontrols2/wearable/wearable.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = wearable
+QT += quick quickcontrols2
+
+SOURCES += \
+ wearable.cpp
+
+RESOURCES += \
+ wearable.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/wearable
+INSTALLS += target
diff --git a/examples/quickcontrols2/wearable/wearable.qml b/examples/quickcontrols2/wearable/wearable.qml
new file mode 100644
index 00000000..01d52b12
--- /dev/null
+++ b/examples/quickcontrols2/wearable/wearable.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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.0 as QQC2
+import "qml"
+import "qml/Style"
+
+QQC2.ApplicationWindow {
+ id: window
+
+ visible: true
+
+ width: 320
+ height: 320
+
+ title: qsTr("Wearable")
+
+ background: Image {
+ source: "images/background.png"
+ }
+
+ header: NaviButton {
+ id: homeButton
+
+ edge: Qt.TopEdge
+ enabled: stackView.depth > 1
+ imageSource: "images/home.png"
+
+ onClicked: stackView.pop(null)
+ }
+
+ footer: NaviButton {
+ id: backButton
+
+ edge: Qt.BottomEdge
+ enabled: stackView.depth > 1
+ imageSource: "images/back.png"
+
+ onClicked: stackView.pop()
+ }
+
+ QQC2.StackView {
+ id: stackView
+
+ focus: true
+ anchors.fill: parent
+
+ initialItem: LauncherPage {
+ onLaunched: stackView.push(page)
+ }
+ }
+}
diff --git a/examples/quickcontrols2/wearable/wearable.qrc b/examples/quickcontrols2/wearable/wearable.qrc
new file mode 100644
index 00000000..a596fb63
--- /dev/null
+++ b/examples/quickcontrols2/wearable/wearable.qrc
@@ -0,0 +1,67 @@
+<RCC>
+ <qresource prefix="/">
+ <file>wearable.qml</file>
+ <file>qml/LauncherPage.qml</file>
+ <file>qml/NaviButton.qml</file>
+ <file>images/background.png</file>
+ <file>images/back.png</file>
+ <file>images/home.png</file>
+ <file>qml/Alarms/AlarmsPage.qml</file>
+ <file>qml/Alarms/images/alarms.png</file>
+ <file>qml/Fitness/fitness.js</file>
+ <file>qml/Fitness/FitnessPage.qml</file>
+ <file>qml/Fitness/images/fitness.png</file>
+ <file>qml/Fitness/images/man-running.png</file>
+ <file>qml/Fitness/images/man-walking.png</file>
+ <file>qml/Navigation/navigation.js</file>
+ <file>qml/Navigation/NavigationPage.qml</file>
+ <file>qml/Navigation/RouteElement.qml</file>
+ <file>qml/Navigation/walk_route.json</file>
+ <file>qml/Navigation/images/end.png</file>
+ <file>qml/Navigation/images/leftturn.png</file>
+ <file>qml/Navigation/images/marker.png</file>
+ <file>qml/Navigation/images/rightturn.png</file>
+ <file>qml/Navigation/images/route.png</file>
+ <file>qml/Navigation/images/start.png</file>
+ <file>qml/Navigation/images/straight.png</file>
+ <file>qml/Navigation/images/uturn.png</file>
+ <file>qml/Notifications/notifications.js</file>
+ <file>qml/Notifications/NotificationsPage.qml</file>
+ <file>qml/Notifications/images/avatarf.png</file>
+ <file>qml/Notifications/images/avatarm.png</file>
+ <file>qml/Notifications/images/missedcall.png</file>
+ <file>qml/Notifications/images/notifications.png</file>
+ <file>qml/Settings/SettingsPage.qml</file>
+ <file>qml/Settings/images/bluetooth.png</file>
+ <file>qml/Settings/images/brightness.png</file>
+ <file>qml/Settings/images/contrast.png</file>
+ <file>qml/Settings/images/settings.png</file>
+ <file>qml/Settings/images/wifi.png</file>
+ <file>qml/Style/qmldir</file>
+ <file>qml/Style/PageIndicator.qml</file>
+ <file>qml/Style/Slider.qml</file>
+ <file>qml/Style/Switch.qml</file>
+ <file>qml/Style/UIStyle.qml</file>
+ <file>qml/Weather/weather.js</file>
+ <file>qml/Weather/weather.json</file>
+ <file>qml/Weather/WeatherPage.qml</file>
+ <file>qml/Weather/images/humidity.png</file>
+ <file>qml/Weather/images/pressure.png</file>
+ <file>qml/Weather/images/sunrise.png</file>
+ <file>qml/Weather/images/sunset.png</file>
+ <file>qml/Weather/images/temperature.png</file>
+ <file>qml/Weather/images/weather.png</file>
+ <file>qml/Weather/images/wind.png</file>
+ <file>qml/WorldClock/Clock.qml</file>
+ <file>qml/WorldClock/WorldClockPage.qml</file>
+ <file>qml/WorldClock/images/center.png</file>
+ <file>qml/WorldClock/images/second.png</file>
+ <file>qml/WorldClock/images/swissdaydial.png</file>
+ <file>qml/WorldClock/images/swissdayhour.png</file>
+ <file>qml/WorldClock/images/swissdayminute.png</file>
+ <file>qml/WorldClock/images/swissnightdial.png</file>
+ <file>qml/WorldClock/images/swissnighthour.png</file>
+ <file>qml/WorldClock/images/swissnightminute.png</file>
+ <file>qml/WorldClock/images/watch.png</file>
+ </qresource>
+</RCC>
diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml
index f71aa462..1d8a561d 100644
--- a/src/imports/controls/RangeSlider.qml
+++ b/src/imports/controls/RangeSlider.qml
@@ -91,5 +91,14 @@ T.RangeSlider {
radius: 3
color: Default.buttonColor
scale: control.horizontal && control.mirrored ? -1 : 1
+
+ Rectangle {
+ x: parent.horizontal ? control.first.position * parent.width + 3 : 0
+ y: parent.horizontal ? 0 : control.second.visualPosition * parent.height + 3
+ width: parent.horizontal ? control.second.position * parent.width - control.first.position * parent.width - 6 : 6
+ height: parent.horizontal ? 6 : control.second.position * parent.height - control.first.position * parent.height - 6
+
+ color: Default.textColor
+ }
}
}
diff --git a/src/imports/controls/designer/BusyIndicatorSpecifics.qml b/src/imports/controls/designer/BusyIndicatorSpecifics.qml
index a694f191..78a00e8e 100644
--- a/src/imports/controls/designer/BusyIndicatorSpecifics.qml
+++ b/src/imports/controls/designer/BusyIndicatorSpecifics.qml
@@ -64,6 +64,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/ButtonSpecifics.qml b/src/imports/controls/designer/ButtonSpecifics.qml
index 71a53b37..4a9e58c2 100644
--- a/src/imports/controls/designer/ButtonSpecifics.qml
+++ b/src/imports/controls/designer/ButtonSpecifics.qml
@@ -50,6 +50,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/CheckBoxSpecifics.qml b/src/imports/controls/designer/CheckBoxSpecifics.qml
index 22184e69..bae0a03c 100644
--- a/src/imports/controls/designer/CheckBoxSpecifics.qml
+++ b/src/imports/controls/designer/CheckBoxSpecifics.qml
@@ -50,6 +50,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/CheckDelegateSpecifics.qml b/src/imports/controls/designer/CheckDelegateSpecifics.qml
index 2503d4ec..bd885430 100644
--- a/src/imports/controls/designer/CheckDelegateSpecifics.qml
+++ b/src/imports/controls/designer/CheckDelegateSpecifics.qml
@@ -50,6 +50,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/ComboBoxSpecifics.qml b/src/imports/controls/designer/ComboBoxSpecifics.qml
index d4a6fbbc..410ae51e 100644
--- a/src/imports/controls/designer/ComboBoxSpecifics.qml
+++ b/src/imports/controls/designer/ComboBoxSpecifics.qml
@@ -77,6 +77,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/ControlSpecifics.qml b/src/imports/controls/designer/ControlSpecifics.qml
index f2d8fa94..1eef1c68 100644
--- a/src/imports/controls/designer/ControlSpecifics.qml
+++ b/src/imports/controls/designer/ControlSpecifics.qml
@@ -45,6 +45,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/DialSpecifics.qml b/src/imports/controls/designer/DialSpecifics.qml
index 123a0c92..52bba078 100644
--- a/src/imports/controls/designer/DialSpecifics.qml
+++ b/src/imports/controls/designer/DialSpecifics.qml
@@ -108,6 +108,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/FrameSpecifics.qml b/src/imports/controls/designer/FrameSpecifics.qml
index f2d8fa94..1eef1c68 100644
--- a/src/imports/controls/designer/FrameSpecifics.qml
+++ b/src/imports/controls/designer/FrameSpecifics.qml
@@ -45,6 +45,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/GroupBoxSpecifics.qml b/src/imports/controls/designer/GroupBoxSpecifics.qml
index b21cee03..8629b991 100644
--- a/src/imports/controls/designer/GroupBoxSpecifics.qml
+++ b/src/imports/controls/designer/GroupBoxSpecifics.qml
@@ -63,6 +63,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/ItemDelegateSpecifics.qml b/src/imports/controls/designer/ItemDelegateSpecifics.qml
index 36126e39..0e0a482e 100644
--- a/src/imports/controls/designer/ItemDelegateSpecifics.qml
+++ b/src/imports/controls/designer/ItemDelegateSpecifics.qml
@@ -50,6 +50,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/PageIndicatorSpecifics.qml b/src/imports/controls/designer/PageIndicatorSpecifics.qml
index e6c4c696..02258c92 100644
--- a/src/imports/controls/designer/PageIndicatorSpecifics.qml
+++ b/src/imports/controls/designer/PageIndicatorSpecifics.qml
@@ -80,6 +80,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/PaneSpecifics.qml b/src/imports/controls/designer/PaneSpecifics.qml
index f2d8fa94..1eef1c68 100644
--- a/src/imports/controls/designer/PaneSpecifics.qml
+++ b/src/imports/controls/designer/PaneSpecifics.qml
@@ -45,6 +45,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/ProgressBarSpecifics.qml b/src/imports/controls/designer/ProgressBarSpecifics.qml
index 5d3e888f..7abb895d 100644
--- a/src/imports/controls/designer/ProgressBarSpecifics.qml
+++ b/src/imports/controls/designer/ProgressBarSpecifics.qml
@@ -106,6 +106,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/RadioButtonSpecifics.qml b/src/imports/controls/designer/RadioButtonSpecifics.qml
index 6ab1de7f..a7a5a3f7 100644
--- a/src/imports/controls/designer/RadioButtonSpecifics.qml
+++ b/src/imports/controls/designer/RadioButtonSpecifics.qml
@@ -50,6 +50,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/RadioDelegateSpecifics.qml b/src/imports/controls/designer/RadioDelegateSpecifics.qml
index 789e2bb2..09ee6590 100644
--- a/src/imports/controls/designer/RadioDelegateSpecifics.qml
+++ b/src/imports/controls/designer/RadioDelegateSpecifics.qml
@@ -50,6 +50,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/SliderSpecifics.qml b/src/imports/controls/designer/SliderSpecifics.qml
index fa242128..fb215001 100644
--- a/src/imports/controls/designer/SliderSpecifics.qml
+++ b/src/imports/controls/designer/SliderSpecifics.qml
@@ -121,6 +121,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/SpinBoxSpecifics.qml b/src/imports/controls/designer/SpinBoxSpecifics.qml
index f85676c1..4290801a 100644
--- a/src/imports/controls/designer/SpinBoxSpecifics.qml
+++ b/src/imports/controls/designer/SpinBoxSpecifics.qml
@@ -108,6 +108,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/SwipeDelegateSpecifics.qml b/src/imports/controls/designer/SwipeDelegateSpecifics.qml
index 36126e39..0e0a482e 100644
--- a/src/imports/controls/designer/SwipeDelegateSpecifics.qml
+++ b/src/imports/controls/designer/SwipeDelegateSpecifics.qml
@@ -50,6 +50,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/SwitchSpecifics.qml b/src/imports/controls/designer/SwitchSpecifics.qml
index 8034bc5a..53172765 100644
--- a/src/imports/controls/designer/SwitchSpecifics.qml
+++ b/src/imports/controls/designer/SwitchSpecifics.qml
@@ -50,6 +50,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/ToolBarSpecifics.qml b/src/imports/controls/designer/ToolBarSpecifics.qml
index f2d8fa94..1eef1c68 100644
--- a/src/imports/controls/designer/ToolBarSpecifics.qml
+++ b/src/imports/controls/designer/ToolBarSpecifics.qml
@@ -45,6 +45,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/ToolButtonSpecifics.qml b/src/imports/controls/designer/ToolButtonSpecifics.qml
index 278ed165..3dc80b2c 100644
--- a/src/imports/controls/designer/ToolButtonSpecifics.qml
+++ b/src/imports/controls/designer/ToolButtonSpecifics.qml
@@ -50,6 +50,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/TumblerSpecifics.qml b/src/imports/controls/designer/TumblerSpecifics.qml
index 39f26089..2018f796 100644
--- a/src/imports/controls/designer/TumblerSpecifics.qml
+++ b/src/imports/controls/designer/TumblerSpecifics.qml
@@ -80,6 +80,10 @@ Column {
width: parent.width
}
+ FontSection {
+ width: parent.width
+ }
+
PaddingSection {
width: parent.width
}
diff --git a/src/imports/controls/designer/images/scrollview-icon.png b/src/imports/controls/designer/images/scrollview-icon.png
new file mode 100644
index 00000000..bbd6783c
--- /dev/null
+++ b/src/imports/controls/designer/images/scrollview-icon.png
Binary files differ
diff --git a/src/imports/controls/designer/images/scrollview-icon16.png b/src/imports/controls/designer/images/scrollview-icon16.png
new file mode 100644
index 00000000..3f7ab00c
--- /dev/null
+++ b/src/imports/controls/designer/images/scrollview-icon16.png
Binary files differ
diff --git a/src/imports/controls/designer/qtquickcontrols2.metainfo b/src/imports/controls/designer/qtquickcontrols2.metainfo
index 35cfa0f2..1f861d41 100644
--- a/src/imports/controls/designer/qtquickcontrols2.metainfo
+++ b/src/imports/controls/designer/qtquickcontrols2.metainfo
@@ -410,6 +410,8 @@ MetaInfo {
libraryIcon: "images/tumbler-icon.png"
version: "2.0"
requiredImport: "QtQuick.Controls"
+
+ Property { name: "model"; type: "int"; value: "10" }
}
}
@@ -460,7 +462,7 @@ MetaInfo {
icon: "images/stackview-icon16.png"
ItemLibraryEntry {
- name: "stack View"
+ name: "Stack View"
category: "Qt Quick - Views"
libraryIcon: "images/stackview-icon.png"
version: "2.1"
@@ -486,4 +488,20 @@ MetaInfo {
Property { name: "height"; type: "int"; value: 200 }
}
}
+
+ Type {
+ name: "QtQuick.Controls.ScrollView"
+ icon: "images/scrollview-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Scroll View"
+ category: "Qt Quick - Views"
+ libraryIcon: "images/scrollview-icon.png"
+ version: "2.2"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "width"; type: "int"; value: 200 }
+ Property { name: "height"; type: "int"; value: 200 }
+ }
+ }
}
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button.gif b/src/imports/controls/doc/images/qtquickcontrols2-button.gif
index 7f2de718..10d626a3 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-button.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-rangeslider.gif b/src/imports/controls/doc/images/qtquickcontrols2-rangeslider.gif
index d35b1502..db565b0a 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-rangeslider.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-rangeslider.gif
Binary files differ
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml
new file mode 100644
index 00000000..de872300
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.1
+
+Item {
+ id: root
+ width: slider.width
+ height: slider.height * 2.0
+
+ Binding { target: slider.anchors; property: "centerIn"; value: root }
+ Binding { target: slider.anchors; property: "verticalCenterOffset"; value: slider.height / 2 }
+ Binding { target: slider; property: "pressed"; value: root.Window.active }
+
+ //! [1]
+ Slider {
+ id: slider
+ value: 0.5
+
+ ToolTip {
+ parent: slider.handle
+ visible: slider.pressed
+ text: slider.value.toFixed(1)
+ }
+ }
+ //! [1]
+}
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
index a3ab35b2..a1f2dd57 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
@@ -79,12 +79,12 @@
be taken, a switch is recommended.
When options can be grouped, you can use a partially checked CheckBox to
- represent the whole group. Use the checkbox's indeterminate state when
- a user selects some, but not all, sub-items in the group.
+ represent the whole group. Use the checkbox's
+ \l {CheckBox::checkState}{partially checked state} when a user selects
+ some, but not all, sub-items in the group.
- The three availables statuses are: checked, unchecked and disabled.
- "Disabled" is useful when the user should not be able to check or uncheck
- a checkbox.
+ The three availables check states are: checked, partially checked and
+ unchecked.
The checkable options are often listed vertically.
@@ -121,9 +121,6 @@
\l RadioButton is used to select only one option from a set of options.
Selecting one option automatically deselects the one selected before.
- The set of options should not be too large, otherwise it starts taking too much
- space on the screen. In that case it would be more practical to use a \l ComboBox.
-
If there are only two mutually exclusive options, combine them into a
single checkbox or a switch.
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-popups.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-popups.qdoc
index 3f8871de..bdcee545 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-popups.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-popups.qdoc
@@ -70,7 +70,7 @@
A popup can be used for:
\list
- \li communicating a message to the user that he must read and acknowledge.
+ \li communicating a message to the user that they must read and acknowledge.
\li displaying an error message.
\li prompting the user to make a choice and/or enter a value.
\endlist
diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
index 0deb429c..3f3a66b0 100644
--- a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
+++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
@@ -99,6 +99,7 @@ void QtQuickControls2MaterialStylePlugin::initializeEngine(QQmlEngine *engine, c
qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator");
qmlRegisterType(typeUrl(QStringLiteral("CursorDelegate.qml")), import, 2, 0, "CursorDelegate");
qmlRegisterType(typeUrl(QStringLiteral("ElevationEffect.qml")), import, 2, 0, "ElevationEffect");
+ qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator");
qmlRegisterType(typeUrl(QStringLiteral("RectangularGlow.qml")), import, 2, 0, "RectangularGlow");
qmlRegisterType(typeUrl(QStringLiteral("SliderHandle.qml")), import, 2, 0, "SliderHandle");
qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator");
diff --git a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
index 29f2b7cc..017a1aad 100644
--- a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
+++ b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
@@ -92,6 +92,8 @@ void QtQuickControls2UniversalStylePlugin::initializeEngine(QQmlEngine *engine,
qmlRegisterType<QQuickUniversalFocusRectangle>(import, 2, 0, "FocusRectangle");
qmlRegisterType<QQuickUniversalBusyIndicator>(import, 2, 0, "BusyIndicatorImpl");
qmlRegisterType<QQuickUniversalProgressBar>(import, 2, 0, "ProgressBarImpl");
+
+ qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator");
qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator");
qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator");
}
diff --git a/src/imports/platform/platform.pri b/src/imports/platform/platform.pri
index 1e300251..2227d89c 100644
--- a/src/imports/platform/platform.pri
+++ b/src/imports/platform/platform.pri
@@ -11,8 +11,7 @@ HEADERS += \
$$PWD/qquickplatformmenuitemgroup_p.h \
$$PWD/qquickplatformmenuseparator_p.h \
$$PWD/qquickplatformmessagedialog_p.h \
- $$PWD/qquickplatformstandardpaths_p.h \
- $$PWD/qquickplatformsystemtrayicon_p.h
+ $$PWD/qquickplatformstandardpaths_p.h
SOURCES += \
$$PWD/qquickplatformcolordialog.cpp \
@@ -27,5 +26,12 @@ SOURCES += \
$$PWD/qquickplatformmenuitemgroup.cpp \
$$PWD/qquickplatformmenuseparator.cpp \
$$PWD/qquickplatformmessagedialog.cpp \
- $$PWD/qquickplatformstandardpaths.cpp \
- $$PWD/qquickplatformsystemtrayicon.cpp
+ $$PWD/qquickplatformstandardpaths.cpp
+
+
+qtConfig(systemtrayicon) {
+ HEADERS += \
+ $$PWD/qquickplatformsystemtrayicon_p.h
+ SOURCES += \
+ $$PWD/qquickplatformsystemtrayicon.cpp
+}
diff --git a/src/imports/platform/qquickplatformmenu.cpp b/src/imports/platform/qquickplatformmenu.cpp
index 34a114f5..fbef8b8d 100644
--- a/src/imports/platform/qquickplatformmenu.cpp
+++ b/src/imports/platform/qquickplatformmenu.cpp
@@ -38,7 +38,6 @@
#include "qquickplatformmenubar_p.h"
#include "qquickplatformmenuitem_p.h"
#include "qquickplatformiconloader_p.h"
-#include "qquickplatformsystemtrayicon_p.h"
#include <QtCore/qloggingcategory.h>
#include <QtGui/qicon.h>
@@ -54,6 +53,10 @@
#include "widgets/qwidgetplatform_p.h"
+#if QT_CONFIG(systemtrayicon)
+#include "qquickplatformsystemtrayicon_p.h"
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -173,8 +176,10 @@ QPlatformMenu * QQuickPlatformMenu::create()
m_handle = m_menuBar->handle()->createMenu();
else if (m_parentMenu && m_parentMenu->handle())
m_handle = m_parentMenu->handle()->createSubMenu();
+#if QT_CONFIG(systemtrayicon)
else if (m_systemTrayIcon && m_systemTrayIcon->handle())
m_handle = m_systemTrayIcon->handle()->createMenu();
+#endif
// TODO: implement ^
// - QCocoaMenuBar::createMenu()
@@ -227,8 +232,10 @@ void QQuickPlatformMenu::sync()
if (m_menuBar && m_menuBar->handle())
m_menuBar->handle()->syncMenu(m_handle);
+#if QT_CONFIG(systemtrayicon)
else if (m_systemTrayIcon && m_systemTrayIcon->handle())
m_systemTrayIcon->handle()->updateMenu(m_handle);
+#endif
for (QQuickPlatformMenuItem *item : m_items)
item->sync();
diff --git a/src/imports/platform/qquickplatformsystemtrayicon_p.h b/src/imports/platform/qquickplatformsystemtrayicon_p.h
index c1eddcda..7aa07512 100644
--- a/src/imports/platform/qquickplatformsystemtrayicon_p.h
+++ b/src/imports/platform/qquickplatformsystemtrayicon_p.h
@@ -53,6 +53,8 @@
#include <QtQml/qqmlparserstatus.h>
#include <QtQml/qqml.h>
+QT_REQUIRE_CONFIG(systemtrayicon);
+
QT_BEGIN_NAMESPACE
class QQuickPlatformMenu;
diff --git a/src/imports/platform/qtlabsplatformplugin.cpp b/src/imports/platform/qtlabsplatformplugin.cpp
index 6a1d5210..bcb9ac98 100644
--- a/src/imports/platform/qtlabsplatformplugin.cpp
+++ b/src/imports/platform/qtlabsplatformplugin.cpp
@@ -52,8 +52,9 @@
#include "qquickplatformmenuseparator_p.h"
#include "qquickplatformstandardpaths_p.h"
-
-#include "qquickplatformsystemtrayicon_p.h"
+#if QT_CONFIG(systemtrayicon)
+# include "qquickplatformsystemtrayicon_p.h"
+#endif
Q_DECLARE_METATYPE(QStandardPaths::StandardLocation)
Q_DECLARE_METATYPE(QStandardPaths::LocateOptions)
@@ -107,7 +108,9 @@ void QtLabsPlatformPlugin::registerTypes(const char *uri)
qRegisterMetaType<QStandardPaths::StandardLocation>();
qRegisterMetaType<QStandardPaths::LocateOptions>();
+#if QT_CONFIG(systemtrayicon)
qmlRegisterType<QQuickPlatformSystemTrayIcon>(uri, 1, 0, "SystemTrayIcon");
+#endif
}
QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformmenu.cpp b/src/imports/platform/widgets/qwidgetplatformmenu.cpp
index eddc7ccc..1aacb0ff 100644
--- a/src/imports/platform/widgets/qwidgetplatformmenu.cpp
+++ b/src/imports/platform/widgets/qwidgetplatformmenu.cpp
@@ -44,7 +44,7 @@
QT_BEGIN_NAMESPACE
QWidgetPlatformMenu::QWidgetPlatformMenu(QObject *parent)
- : m_menu(new QMenu)
+ : m_tag(reinterpret_cast<quintptr>(this)), m_menu(new QMenu)
{
setParent(parent);
@@ -69,6 +69,10 @@ void QWidgetPlatformMenu::insertMenuItem(QPlatformMenuItem *item, QPlatformMenuI
QWidgetPlatformMenuItem *widgetBefore = qobject_cast<QWidgetPlatformMenuItem *>(before);
m_menu->insertAction(widgetBefore ? widgetBefore->action() : nullptr, widgetItem->action());
+ int index = m_items.indexOf(widgetBefore);
+ if (index < 0)
+ index = m_items.count();
+ m_items.insert(index, widgetItem);
}
void QWidgetPlatformMenu::removeMenuItem(QPlatformMenuItem *item)
@@ -77,6 +81,7 @@ void QWidgetPlatformMenu::removeMenuItem(QPlatformMenuItem *item)
if (!widgetItem)
return;
+ m_items.removeOne(widgetItem);
m_menu->removeAction(widgetItem->action());
}
@@ -87,17 +92,17 @@ void QWidgetPlatformMenu::syncMenuItem(QPlatformMenuItem *item)
void QWidgetPlatformMenu::syncSeparatorsCollapsible(bool enable)
{
- Q_UNUSED(enable);
+ m_menu->setSeparatorsCollapsible(enable);
}
quintptr QWidgetPlatformMenu::tag() const
{
- return 0;
+ return m_tag;
}
void QWidgetPlatformMenu::setTag(quintptr tag)
{
- Q_UNUSED(tag);
+ m_tag = tag;
}
void QWidgetPlatformMenu::setText(const QString &text)
@@ -163,24 +168,26 @@ void QWidgetPlatformMenu::dismiss()
QPlatformMenuItem *QWidgetPlatformMenu::menuItemAt(int position) const
{
- Q_UNUSED(position);
- return nullptr;
+ return m_items.value(position);
}
QPlatformMenuItem *QWidgetPlatformMenu::menuItemForTag(quintptr tag) const
{
- Q_UNUSED(tag);
+ for (QWidgetPlatformMenuItem *item : m_items) {
+ if (item->tag() == tag)
+ return item;
+ }
return nullptr;
}
QPlatformMenuItem *QWidgetPlatformMenu::createMenuItem() const
{
- return nullptr;
+ return new QWidgetPlatformMenuItem;
}
QPlatformMenu *QWidgetPlatformMenu::createSubMenu() const
{
- return nullptr;
+ return new QWidgetPlatformMenu;
}
QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformmenu_p.h b/src/imports/platform/widgets/qwidgetplatformmenu_p.h
index 2eea6470..1df9ef78 100644
--- a/src/imports/platform/widgets/qwidgetplatformmenu_p.h
+++ b/src/imports/platform/widgets/qwidgetplatformmenu_p.h
@@ -53,6 +53,7 @@
QT_BEGIN_NAMESPACE
class QMenu;
+class QWidgetPlatformMenuItem;
class QWidgetPlatformMenu : public QPlatformMenu
{
@@ -91,7 +92,9 @@ public:
QPlatformMenu *createSubMenu() const override;
private:
+ quintptr m_tag;
QScopedPointer<QMenu> m_menu;
+ QVector<QWidgetPlatformMenuItem *> m_items;
};
QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformmenuitem.cpp b/src/imports/platform/widgets/qwidgetplatformmenuitem.cpp
index c7576296..8519c899 100644
--- a/src/imports/platform/widgets/qwidgetplatformmenuitem.cpp
+++ b/src/imports/platform/widgets/qwidgetplatformmenuitem.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "qwidgetplatformmenuitem_p.h"
+#include "qwidgetplatformmenu_p.h"
#include <QtWidgets/qmenu.h>
#include <QtWidgets/qaction.h>
@@ -42,7 +43,7 @@
QT_BEGIN_NAMESPACE
QWidgetPlatformMenuItem::QWidgetPlatformMenuItem(QObject *parent)
- : m_action(new QAction)
+ : m_tag(reinterpret_cast<quintptr>(this)), m_action(new QAction)
{
setParent(parent);
connect(m_action.data(), &QAction::hovered, this, &QPlatformMenuItem::hovered);
@@ -60,12 +61,12 @@ QAction *QWidgetPlatformMenuItem::action() const
quintptr QWidgetPlatformMenuItem::tag() const
{
- return 0;
+ return m_tag;
}
void QWidgetPlatformMenuItem::setTag(quintptr tag)
{
- Q_UNUSED(tag);
+ m_tag = tag;
}
void QWidgetPlatformMenuItem::setText(const QString &text)
@@ -80,7 +81,8 @@ void QWidgetPlatformMenuItem::setIcon(const QIcon &icon)
void QWidgetPlatformMenuItem::setMenu(QPlatformMenu *menu)
{
- m_action->setMenu(qobject_cast<QMenu *>(menu));
+ QWidgetPlatformMenu *widgetMenu = qobject_cast<QWidgetPlatformMenu *>(menu);
+ m_action->setMenu(widgetMenu ? widgetMenu->menu() : nullptr);
}
void QWidgetPlatformMenuItem::setVisible(bool visible)
@@ -113,10 +115,12 @@ void QWidgetPlatformMenuItem::setChecked(bool checked)
m_action->setChecked(checked);
}
+#if QT_CONFIG(shortcut)
void QWidgetPlatformMenuItem::setShortcut(const QKeySequence &shortcut)
{
m_action->setShortcut(shortcut);
}
+#endif
void QWidgetPlatformMenuItem::setEnabled(bool enabled)
{
diff --git a/src/imports/platform/widgets/qwidgetplatformmenuitem_p.h b/src/imports/platform/widgets/qwidgetplatformmenuitem_p.h
index 82398bb8..752f8a03 100644
--- a/src/imports/platform/widgets/qwidgetplatformmenuitem_p.h
+++ b/src/imports/platform/widgets/qwidgetplatformmenuitem_p.h
@@ -76,11 +76,14 @@ public:
void setRole(MenuRole role) override;
void setCheckable(bool checkable) override;
void setChecked(bool checked) override;
+#if QT_CONFIG(shortcut)
void setShortcut(const QKeySequence& shortcut) override;
+#endif
void setEnabled(bool enabled) override;
void setIconSize(int size) override;
private:
+ quintptr m_tag;
QScopedPointer<QAction> m_action;
};
diff --git a/src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp b/src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp
index 1f851ba1..365692dc 100644
--- a/src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp
+++ b/src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp
@@ -71,7 +71,9 @@ bool QWidgetPlatformMessageDialog::show(Qt::WindowFlags flags, Qt::WindowModalit
m_dialog->setIcon(static_cast<QMessageBox::Icon>(options->icon()));
m_dialog->setText(options->text());
m_dialog->setInformativeText(options->informativeText());
+#if QT_CONFIG(textedit)
m_dialog->setDetailedText(options->detailedText());
+#endif
m_dialog->setStandardButtons(static_cast<QMessageBox::StandardButtons>(int(options->standardButtons())));
return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent);
diff --git a/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp
index 4ef1e423..1cdfcfde 100644
--- a/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp
+++ b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp
@@ -78,11 +78,13 @@ void QWidgetPlatformSystemTrayIcon::updateToolTip(const QString &tooltip)
void QWidgetPlatformSystemTrayIcon::updateMenu(QPlatformMenu *menu)
{
+#if QT_CONFIG(menu)
QWidgetPlatformMenu *widgetMenu = qobject_cast<QWidgetPlatformMenu *>(menu);
if (!widgetMenu)
return;
m_systray->setContextMenu(widgetMenu->menu());
+#endif
}
QRect QWidgetPlatformSystemTrayIcon::geometry() const
diff --git a/src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h
index 90abf97e..11ea5377 100644
--- a/src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h
+++ b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h
@@ -50,6 +50,8 @@
#include <QtGui/qpa/qplatformsystemtrayicon.h>
+QT_REQUIRE_CONFIG(systemtrayicon);
+
QT_BEGIN_NAMESPACE
class QSystemTrayIcon;
diff --git a/src/imports/platform/widgets/widgets.pri b/src/imports/platform/widgets/widgets.pri
index 84efd930..54ad7187 100644
--- a/src/imports/platform/widgets/widgets.pri
+++ b/src/imports/platform/widgets/widgets.pri
@@ -2,11 +2,14 @@ QT += widgets
DEPENDPATH += $$PWD
HEADERS += \
- $$PWD/qwidgetplatform_p.h \
- $$PWD/qwidgetplatformsystemtrayicon_p.h
+ $$PWD/qwidgetplatform_p.h
-SOURCES += \
- $$PWD/qwidgetplatformsystemtrayicon.cpp
+qtConfig(systemtrayicon) {
+ HEADERS += \
+ $$PWD/qwidgetplatformsystemtrayicon_p.h
+ SOURCES += \
+ $$PWD/qwidgetplatformsystemtrayicon.cpp
+}
qtConfig(colordialog) | qtConfig(filedialog) | qtConfig(fontdialog) | qtConfig(messagebox) {
HEADERS += \
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index f4c0f348..a43d5baf 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -232,7 +232,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
#endif
// QtQuick.Templates 2.2 (new types and revisions in Qt 5.9)
- qmlRegisterRevision<QQuickAbstractButton, 2>(uri, 2, 2);
+ qmlRegisterType<QQuickAbstractButton, 2>(uri, 2, 2, "AbstractButton");
qmlRegisterType<QQuickComboBox, 2>(uri, 2, 2, "ComboBox");
qmlRegisterType<QQuickDelayButton>(uri, 2, 2, "DelayButton");
qmlRegisterType<QQuickDial, 2>(uri, 2, 2, "Dial");
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index c40db20b..d49c9b0e 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -317,6 +317,8 @@ QQuickApplicationWindow::QQuickApplicationWindow(QWindow *parent)
QQuickApplicationWindow::~QQuickApplicationWindow()
{
Q_D(QQuickApplicationWindow);
+ d->setActiveFocusControl(nullptr);
+ disconnect(this, SIGNAL(activeFocusItemChanged()), this, SLOT(_q_updateActiveFocus()));
if (d->header)
QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility |
QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 3aabd238..29fa5e55 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -1158,8 +1158,10 @@ void QQuickComboBox::setValidator(QValidator *validator)
return;
d->extra.value().validator = validator;
+#if QT_CONFIG(validator)
if (validator)
validator->setLocale(d->locale);
+#endif
emit validatorChanged();
}
@@ -1337,10 +1339,12 @@ bool QQuickComboBox::eventFilter(QObject *object, QEvent *event)
d->hidePopup(false);
setPressed(false);
break;
+#if QT_CONFIG(im)
case QEvent::InputMethod:
if (d->extra.isAllocated())
d->extra->allowComplete = !static_cast<QInputMethodEvent*>(event)->commitString().isEmpty();
break;
+#endif
default:
break;
}
@@ -1363,6 +1367,7 @@ void QQuickComboBox::focusOutEvent(QFocusEvent *event)
setPressed(false);
}
+#if QT_CONFIG(im)
void QQuickComboBox::inputMethodEvent(QInputMethodEvent *event)
{
Q_D(QQuickComboBox);
@@ -1372,6 +1377,7 @@ void QQuickComboBox::inputMethodEvent(QInputMethodEvent *event)
else
event->ignore();
}
+#endif
void QQuickComboBox::keyPressEvent(QKeyEvent *event)
{
@@ -1544,8 +1550,10 @@ void QQuickComboBox::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
void QQuickComboBox::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
{
QQuickControl::localeChange(newLocale, oldLocale);
+#if QT_CONFIG(validator)
if (QValidator *v = validator())
v->setLocale(newLocale);
+#endif
}
QFont QQuickComboBox::defaultFont() const
diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h
index b6ed4906..76dce2d5 100644
--- a/src/quicktemplates2/qquickcombobox_p.h
+++ b/src/quicktemplates2/qquickcombobox_p.h
@@ -178,7 +178,9 @@ protected:
bool eventFilter(QObject *object, QEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
+#if QT_CONFIG(im)
void inputMethodEvent(QInputMethodEvent *event) override;
+#endif
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 4dd07b07..9b541803 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -427,6 +427,9 @@ void QQuickPopupPrivate::setWindow(QQuickWindow *newWindow)
window = newWindow;
emit q->windowChanged(newWindow);
+
+ if (complete && visible && window)
+ transitionManager.transitionEnter();
}
void QQuickPopupPrivate::itemDestroyed(QQuickItem *item)
@@ -1729,15 +1732,17 @@ void QQuickPopup::classBegin()
void QQuickPopup::componentComplete()
{
Q_D(QQuickPopup);
- d->complete = true;
if (!parentItem()) {
if (QQuickItem *item = qobject_cast<QQuickItem *>(parent()))
setParentItem(item);
else if (QQuickWindow *window = qobject_cast<QQuickWindow *>(parent()))
setParentItem(window->contentItem());
}
- if (d->visible)
+
+ if (d->visible && d->window)
d->transitionManager.transitionEnter();
+
+ d->complete = true;
d->popupItem->componentComplete();
}
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index 9fbf9764..21d74dd8 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -358,11 +358,13 @@ void QQuickTextAreaPrivate::implicitHeightChanged()
void QQuickTextAreaPrivate::readOnlyChanged(bool isReadOnly)
{
+ Q_UNUSED(isReadOnly);
#if QT_CONFIG(accessibility)
if (accessibleAttached)
accessibleAttached->set_readOnly(isReadOnly);
-#else
- Q_UNUSED(isReadOnly)
+#endif
+#if QT_CONFIG(cursor)
+ q_func()->setCursor(isReadOnly ? Qt::ArrowCursor : Qt::IBeamCursor);
#endif
}
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp
index a15f923f..e6ca2496 100644
--- a/src/quicktemplates2/qquicktextfield.cpp
+++ b/src/quicktemplates2/qquicktextfield.cpp
@@ -221,11 +221,13 @@ void QQuickTextFieldPrivate::implicitHeightChanged()
void QQuickTextFieldPrivate::readOnlyChanged(bool isReadOnly)
{
+ Q_UNUSED(isReadOnly);
#if QT_CONFIG(accessibility)
if (accessibleAttached)
accessibleAttached->set_readOnly(isReadOnly);
-#else
- Q_UNUSED(isReadOnly)
+#endif
+#if QT_CONFIG(cursor)
+ q_func()->setCursor(isReadOnly ? Qt::ArrowCursor : Qt::IBeamCursor);
#endif
}
diff --git a/tests/auto/applicationwindow/data/clearfocusondestruction.qml b/tests/auto/applicationwindow/data/clearfocusondestruction.qml
new file mode 100644
index 00000000..3589439e
--- /dev/null
+++ b/tests/auto/applicationwindow/data/clearfocusondestruction.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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
+import QtQuick.Layouts 1.3
+import QtGraphicalEffects 1.0
+
+ApplicationWindow {
+ width: 200
+ height: 200
+ visible: true
+
+ property alias textfield: textfield
+
+ /*
+ * The code below is the simplest way we can trigger that the signal
+ * activeFocusItemChanged() is emitted during destruction of the
+ * ApplicationWindow. This caused a crash in QQuickApplicationWindow.
+ */
+ FastBlur {
+ id: fastBlur
+ anchors.fill: parent
+ radius: 30
+ source: ShaderEffectSource {
+ id: effectsource
+ sourceItem: textfield
+ sourceRect: Qt.rect( 0, 0, fastBlur.width, fastBlur.height )
+ }
+ }
+
+ TextField {
+ id: textfield
+ anchors.bottom: parent.bottom
+ focus: true
+ }
+}
diff --git a/tests/auto/applicationwindow/tst_applicationwindow.cpp b/tests/auto/applicationwindow/tst_applicationwindow.cpp
index 2a3f849c..b72bb8f2 100644
--- a/tests/auto/applicationwindow/tst_applicationwindow.cpp
+++ b/tests/auto/applicationwindow/tst_applicationwindow.cpp
@@ -72,6 +72,7 @@ private slots:
void activeFocusControl_data();
void activeFocusControl();
void focusAfterPopupClosed();
+ void clearFocusOnDestruction();
void layout();
};
@@ -685,6 +686,47 @@ void tst_applicationwindow::focusAfterPopupClosed()
QCOMPARE(spy.count(), 2);
}
+void tst_applicationwindow::clearFocusOnDestruction()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("clearfocusondestruction.qml"));
+ QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow*>(component.create()));
+ QVERIFY(window);
+
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+ QVERIFY(QGuiApplication::focusWindow() == window.data());
+
+ QQuickItem* contentItem = window->contentItem();
+ QVERIFY(contentItem);
+ QVERIFY(contentItem->hasActiveFocus());
+
+ QQuickItem* focusScope = window->property("textfield").value<QQuickItem*>();
+ QVERIFY(focusScope);
+ QVERIFY(focusScope->hasActiveFocus());
+
+ QSignalSpy spy(window.data(), SIGNAL(activeFocusControlChanged()));
+ // destroy the window, do not crash
+ window.reset();
+
+ /*
+ QQuickWindow::activeFocusItemChanged() is emitted inconsistently and
+ only for certain use cases. Ideally it should be emitted whenever a
+ QQuickWindow with a focus item is destroyed, but it doesn't... It might
+ also be favorable to not emit it for performance reason.
+
+ However, activeFocusControlChanged() is emitted more consistently, which
+ of course makes it inconsistent with the emission of
+ activeFocusItemChanged()....
+
+ Therefore, if you have good reasons to change the behavior (and not emit
+ it) take the test below with a grain of salt.
+ */
+ QCOMPARE(spy.count(), 1);
+}
+
void tst_applicationwindow::layout()
{
QQmlEngine engine;
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml
index b9c72da9..413b7d53 100644
--- a/tests/auto/controls/data/tst_swipedelegate.qml
+++ b/tests/auto/controls/data/tst_swipedelegate.qml
@@ -119,28 +119,29 @@ TestCase {
}
}
- function test_horizontalAnchors_data() {
- return [
- { tag: "background, fill", component: backgroundFillComponent, itemName: "background", warningLocation: ":69:25" },
- { tag: "background, centerIn", component: backgroundCenterInComponent, itemName: "background", warningLocation: ":76:25" },
- { tag: "background, left", component: backgroundLeftComponent, itemName: "background", warningLocation: ":83:25" },
- { tag: "background, right", component: backgroundRightComponent, itemName: "background", warningLocation: ":90:25" },
- { tag: "contentItem, fill", component: contentItemFillComponent, itemName: "contentItem", warningLocation: ":97:26" },
- { tag: "contentItem, centerIn", component: contentItemCenterInComponent, itemName: "contentItem", warningLocation: ":104:26" },
- { tag: "contentItem, left", component: contentItemLeftComponent, itemName: "contentItem", warningLocation: ":111:26" },
- { tag: "contentItem, right", component: contentItemRightComponent, itemName: "contentItem", warningLocation: ":118:26" }
- ];
- }
+ // Temporary solution to allow qt5 merge to go through; see: QTBUG-59536
+// function test_horizontalAnchors_data() {
+// return [
+// { tag: "background, fill", component: backgroundFillComponent, itemName: "background", warningLocation: ":69:25" },
+// { tag: "background, centerIn", component: backgroundCenterInComponent, itemName: "background", warningLocation: ":76:25" },
+// { tag: "background, left", component: backgroundLeftComponent, itemName: "background", warningLocation: ":83:25" },
+// { tag: "background, right", component: backgroundRightComponent, itemName: "background", warningLocation: ":90:25" },
+// { tag: "contentItem, fill", component: contentItemFillComponent, itemName: "contentItem", warningLocation: ":97:26" },
+// { tag: "contentItem, centerIn", component: contentItemCenterInComponent, itemName: "contentItem", warningLocation: ":104:26" },
+// { tag: "contentItem, left", component: contentItemLeftComponent, itemName: "contentItem", warningLocation: ":111:26" },
+// { tag: "contentItem, right", component: contentItemRightComponent, itemName: "contentItem", warningLocation: ":118:26" }
+// ];
+// }
- function test_horizontalAnchors(data) {
- var warningMessage = Qt.resolvedUrl("tst_swipedelegate.qml") + data.warningLocation
- + ": QML : SwipeDelegate: cannot use horizontal anchors with " + data.itemName + "; unable to layout the item."
+// function test_horizontalAnchors(data) {
+// var warningMessage = Qt.resolvedUrl("tst_swipedelegate.qml") + data.warningLocation
+// + ": QML : SwipeDelegate: cannot use horizontal anchors with " + data.itemName + "; unable to layout the item."
- ignoreWarning(warningMessage);
+// ignoreWarning(warningMessage);
- var control = createTemporaryObject(data.component, testCase);
- verify(control.contentItem);
- }
+// var control = createTemporaryObject(data.component, testCase);
+// verify(control.contentItem);
+// }
Component {
id: greenLeftComponent
@@ -211,90 +212,90 @@ TestCase {
}
}
- function test_settingDelegates() {
- var control = createTemporaryObject(swipeDelegateComponent, testCase);
- verify(control);
-
- ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
- ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
- control.swipe.behind = itemComponent;
-
- // Shouldn't be any warnings when unsetting delegates.
- control.swipe.left = null;
- compare(control.swipe.leftItem, null);
-
- // right is still set.
- ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
- ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
- control.swipe.behind = itemComponent;
-
- control.swipe.right = null;
- compare(control.swipe.rightItem, null);
-
- control.swipe.behind = itemComponent;
-
- ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
- ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
- control.swipe.left = itemComponent;
-
- ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
- ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
- control.swipe.right = itemComponent;
-
- control.swipe.behind = null;
- control.swipe.left = greenLeftComponent;
- control.swipe.right = redRightComponent;
-
- // Test that the user is warned when attempting to set or unset left or
- // right item while they're exposed.
- // First, try the left item.
- swipe(control, 0.0, 1.0);
-
- var oldLeft = control.swipe.left;
- var oldLeftItem = control.swipe.leftItem;
- ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
- ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
- control.swipe.left = null;
- compare(control.swipe.left, oldLeft);
- compare(control.swipe.leftItem, oldLeftItem);
-
- // Try the same thing with the right item.
- swipe(control, 1.0, -1.0);
-
- var oldRight = control.swipe.right;
- var oldRightItem = control.swipe.rightItem;
- ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
- ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
- control.swipe.right = null;
- compare(control.swipe.right, oldRight);
- compare(control.swipe.rightItem, oldRightItem);
-
- // Return to the default position.
- swipe(control, -1.0, 0.0);
-
- tryCompare(control.background, "x", 0, 1000);
-
- // Try the same thing with the behind item.
- control.swipe.left = null;
- verify(!control.swipe.left);
- verify(!control.swipe.leftItem);
- control.swipe.right = null;
- verify(!control.swipe.right);
- verify(!control.swipe.rightItem);
- control.swipe.behind = greenLeftComponent;
- verify(control.swipe.behind);
- verify(!control.swipe.behindItem);
-
- swipe(control, 0.0, 1.0);
-
- var oldBehind = control.swipe.behind;
- var oldBehindItem = control.swipe.behindItem;
- ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
- ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
- control.swipe.behind = null;
- compare(control.swipe.behind, oldBehind);
- compare(control.swipe.behindItem, oldBehindItem);
- }
+// function test_settingDelegates() {
+// var control = createTemporaryObject(swipeDelegateComponent, testCase);
+// verify(control);
+
+// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
+// control.swipe.behind = itemComponent;
+
+// // Shouldn't be any warnings when unsetting delegates.
+// control.swipe.left = null;
+// compare(control.swipe.leftItem, null);
+
+// // right is still set.
+// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
+// control.swipe.behind = itemComponent;
+
+// control.swipe.right = null;
+// compare(control.swipe.rightItem, null);
+
+// control.swipe.behind = itemComponent;
+
+// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
+// control.swipe.left = itemComponent;
+
+// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties")
+// control.swipe.right = itemComponent;
+
+// control.swipe.behind = null;
+// control.swipe.left = greenLeftComponent;
+// control.swipe.right = redRightComponent;
+
+// // Test that the user is warned when attempting to set or unset left or
+// // right item while they're exposed.
+// // First, try the left item.
+// swipe(control, 0.0, 1.0);
+
+// var oldLeft = control.swipe.left;
+// var oldLeftItem = control.swipe.leftItem;
+// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+// ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
+// control.swipe.left = null;
+// compare(control.swipe.left, oldLeft);
+// compare(control.swipe.leftItem, oldLeftItem);
+
+// // Try the same thing with the right item.
+// swipe(control, 1.0, -1.0);
+
+// var oldRight = control.swipe.right;
+// var oldRightItem = control.swipe.rightItem;
+// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+// ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
+// control.swipe.right = null;
+// compare(control.swipe.right, oldRight);
+// compare(control.swipe.rightItem, oldRightItem);
+
+// // Return to the default position.
+// swipe(control, -1.0, 0.0);
+
+// tryCompare(control.background, "x", 0, 1000);
+
+// // Try the same thing with the behind item.
+// control.swipe.left = null;
+// verify(!control.swipe.left);
+// verify(!control.swipe.leftItem);
+// control.swipe.right = null;
+// verify(!control.swipe.right);
+// verify(!control.swipe.rightItem);
+// control.swipe.behind = greenLeftComponent;
+// verify(control.swipe.behind);
+// verify(!control.swipe.behindItem);
+
+// swipe(control, 0.0, 1.0);
+
+// var oldBehind = control.swipe.behind;
+// var oldBehindItem = control.swipe.behindItem;
+// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
+// ":168:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
+// control.swipe.behind = null;
+// compare(control.swipe.behind, oldBehind);
+// compare(control.swipe.behindItem, oldBehindItem);
+// }
function test_defaults() {
var control = createTemporaryObject(swipeDelegateComponent, testCase);
diff --git a/tests/auto/snippets/tst_snippets.cpp b/tests/auto/snippets/tst_snippets.cpp
index e5e3ab9e..f870ec7d 100644
--- a/tests/auto/snippets/tst_snippets.cpp
+++ b/tests/auto/snippets/tst_snippets.cpp
@@ -53,6 +53,7 @@ private slots:
void screenshots_data();
private:
+ QQuickView view;
QMap<QString, QStringPair> snippetPaths;
QMap<QString, QStringPair> screenshotSnippetPaths;
};
@@ -97,7 +98,15 @@ static void loadAndShow(QQuickView *view, const QString &source)
QSignalSpy warnings(view->engine(), SIGNAL(warnings(QList<QQmlError>)));
QVERIFY(warnings.isValid());
- view->setSource(QUrl::fromLocalFile(source));
+ QUrl url = QUrl::fromLocalFile(source);
+ QQmlComponent *component = new QQmlComponent(view->engine(), view);
+ component->loadUrl(url);
+
+ QObject *root = component->beginCreate(view->rootContext());
+ QVERIFY(root);
+ view->setContent(url, component, root);
+ component->completeCreate();
+
QCOMPARE(view->status(), QQuickView::Ready);
QVERIFY(view->errors().isEmpty());
QVERIFY(view->rootObject());
@@ -113,7 +122,6 @@ void tst_Snippets::verify()
{
QFETCH(QString, input);
- QQuickView view;
loadAndShow(&view, input);
QGuiApplication::processEvents();
}
@@ -132,7 +140,6 @@ void tst_Snippets::screenshots()
QFETCH(QString, input);
QFETCH(QString, output);
- QQuickView view;
loadAndShow(&view, input);
QSharedPointer<QQuickItemGrabResult> result = view.contentItem()->grabToImage();
diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp
index a665a678..2a7d55bd 100644
--- a/tests/manual/gifs/tst_gifs.cpp
+++ b/tests/manual/gifs/tst_gifs.cpp
@@ -416,6 +416,8 @@ void tst_Gifs::button()
gifRecorder.setOutputDir(outputDir);
gifRecorder.setRecordingDuration(3);
gifRecorder.setQmlFileName(qmlFileName);
+ // Seems to be necessary to show the Default button background.
+ gifRecorder.setHighQuality(true);
gifRecorder.start();