diff options
author | Liang Qi <liang.qi@qt.io> | 2017-03-30 13:46:40 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-03-30 13:46:40 +0200 |
commit | c3cc73e3087db62a8427ff569abff1a8289dae83 (patch) | |
tree | 9839a823f220f57775a732658b8aab0fa4ba9be3 /examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc | |
parent | 2e0cded94716430658d4afe3e0fdd6fe4cf6362c (diff) | |
parent | bc514fba81b67afb41ee91ea917352ad674630a5 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/imports/controls/RangeSlider.qml
Change-Id: I0b930583135f044cb690217c026e6a120b73fcb7
Diffstat (limited to 'examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc')
-rw-r--r-- | examples/quickcontrols2/wearable/doc/src/qtquickcontrols2-wearable.qdoc | 162 |
1 files changed, 162 insertions, 0 deletions
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 +*/ |