/usr/share/qt5/doc/qtquickcontrols2/qtquickcontrols2-wearable-example.html is in qtquickcontrols2-5-doc-html 5.9.5-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qtquickcontrols2-wearable.qdoc -->
<title>Qt Quick Controls 2 - Wearable Demo | Qt Quick Controls 2 5.9</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
// loading style sheet breaks anchors that were jumped to before
// so force jumping to anchor again
setTimeout(function() {
var anchor = location.hash;
// need to jump to different anchor first (e.g. none)
location.hash = "#";
setTimeout(function() {
location.hash = anchor;
}, 0);
}, 0);
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td >Qt 5.9</td><td ><a href="qtquickcontrols2-index.html">Qt Quick Controls 2</a></td><td ><a href="qtquickcontrols2-examples.html">Qt Quick Controls 2 Examples</a></td><td >Qt Quick Controls 2 - Wearable Demo</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.5 Reference Documentation</td>
</tr></table>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#structure">Structure</a></li>
<li class="level1"><a href="#styling">Styling</a></li>
<li class="level1"><a href="#custom-type">Custom Type</a></li>
<li class="level1"><a href="#launcher-page">Launcher Page</a></li>
<li class="level1"><a href="#applications">Applications</a></li>
<li class="level2"><a href="#navigation">Navigation</a></li>
<li class="level2"><a href="#weather">Weather</a></li>
<li class="level2"><a href="#world-clock">World Clock</a></li>
<li class="level2"><a href="#others">Others</a></li>
<li class="level1"><a href="#running-the-example">Running the Example</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Qt Quick Controls 2 - Wearable Demo</h1>
<span class="subtitle"></span>
<!-- $$$wearable-description -->
<div class="descr"> <a name="details"></a>
<p class="centerAlign"><img src="images/qtquickcontrols2-wearable.png" alt="" /></p><p>The <i>Wearable Demo</i> consists of an application launcher and a collection of small and simple example applications aimed at wearable devices.</p>
<a name="structure"></a>
<h2 id="structure">Structure</h2>
<p>The main .qml file <code>wearable.qml</code> consists of an <a href="qml-qtquick-controls2-applicationwindow.html">ApplicationWindow</a>, a <a href="qtquickcontrols2-chattutorial-example.html#stackview">StackView</a> for a stack-based navigation model, and buttons for interactive navigation.</p>
<pre class="qml">
<span class="type">QQC2</span>.ApplicationWindow {
<span class="name">id</span>: <span class="name">window</span>
...
<span class="name">header</span>: <span class="name">NaviButton</span> {
<span class="name">id</span>: <span class="name">homeButton</span>
...
<span class="name">onClicked</span>: <span class="name">stackView</span>.<span class="name">pop</span>(<span class="number">null</span>)
}
<span class="name">footer</span>: <span class="name">NaviButton</span> {
<span class="name">id</span>: <span class="name">backButton</span>
...
<span class="name">onClicked</span>: <span class="name">stackView</span>.<span class="name">pop</span>()
}
<span class="type">QQC2</span>.StackView {
<span class="name">id</span>: <span class="name">stackView</span>
...
<span class="name">onLaunched</span>: <span class="name">stackView</span>.<span class="name">push</span>(<span class="name">page</span>)
}
}
}
</pre>
<a name="styling"></a>
<h2 id="styling">Styling</h2>
<p>The demo uses a custom <a href="qtquickcontrols2-styles.html">Qt Quick Controls 2 style</a> embedded into the demo's resources. Since the style is specific to this particular demo, it only needs to implement a few controls. The style also provides a singleton type that contains various styling attributes, such as fonts and colors.</p>
<ul>
<li><code>qml/Style/PageIndicator.qml</code></li>
<li><code>qml/Style/Slider.qml</code></li>
<li><code>qml/Style/Switch.qml</code></li>
<li><code>qml/Style/UIStyle.qml</code></li>
</ul>
<p>The style is applied in <code>main()</code> in <code>wearable.cpp</code>:</p>
<pre class="cpp">
<span class="type"><a href="qquickstyle.html">QQuickStyle</a></span><span class="operator">::</span>setStyle(<span class="type"><a href="../qtcore/qstring.html#QStringLiteral">QStringLiteral</a></span>(<span class="string">"qrc:/qml/Style"</span>));
</pre>
<p>The main benefit of using the built-in styling system is that the style selection is fully transparent to the application code. There is no need to import a specific folder that contains the styled controls. This way, the application can be run with other styles too.</p>
<a name="custom-type"></a>
<h2 id="custom-type">Custom Type</h2>
<p>The demo application contains a custom button type implemented in <code>qml/NaviButton.qml</code>. The navigation button is used as a home and back button in <code>wearable.qml</code>. <code>NaviButton</code> extends the standard <a href="qml-qtquick-controls2-abstractbutton.html">AbstractButton</a> API with properties that control the slide in and slide out transitions and the button image.</p>
<pre class="qml">
<span class="type">QQC2</span>.AbstractButton {
<span class="name">id</span>: <span class="name">button</span>
property <span class="type">int</span> <span class="name">edge</span>: <span class="name">Qt</span>.<span class="name">TopEdge</span>
property <span class="type">alias</span> <span class="name">imageSource</span>: <span class="name">image</span>.<span class="name">source</span>
<span class="name">contentItem</span>: <span class="name">Image</span> {
<span class="name">id</span>: <span class="name">image</span>
...
}
<span class="name">background</span>: <span class="name">Rectangle</span> {
...
}
<span class="name">transform</span>: <span class="name">Translate</span> {
Behavior on <span class="name">y</span> { <span class="type"><a href="../qtquick/qml-qtquick-numberanimation.html">NumberAnimation</a></span> { } }
<span class="name">y</span>: <span class="name">enabled</span> ? <span class="number">0</span> : <span class="name">edge</span> <span class="operator">===</span> <span class="name">Qt</span>.<span class="name">TopEdge</span> ? -<span class="name">button</span>.<span class="name">height</span> : <span class="name">button</span>.<span class="name">height</span>
}
}
</pre>
<a name="launcher-page"></a>
<h2 id="launcher-page">Launcher Page</h2>
<p>The application launcher, which is specified as the initial content above, is implemented using a circular <a href="../qtquick/qml-qtquick-pathview.html">PathView</a> in <code>LauncherPage.qml</code>. Each application is contained within its own .qml file, which is listed in a <a href="../qtqml/qml-qtqml-models-listmodel.html">ListModel</a> on the launcher page.</p>
<pre class="qml">
<span class="type"><a href="../qtquick/qml-qtquick-pathview.html">PathView</a></span> {
<span class="name">id</span>: <span class="name">circularView</span>
signal <span class="type">launched</span>(string page)
...
<span class="name">model</span>: <span class="name">ListModel</span> {
<span class="type"><a href="../qtqml/qml-qtqml-models-listelement.html">ListElement</a></span> {
<span class="name">title</span>: <span class="name">qsTr</span>(<span class="string">"World Clock"</span>)
<span class="name">icon</span>: <span class="string">"WorldClock/images/worldclock.png"</span>
<span class="name">page</span>: <span class="string">"WorldClock/WorldClockPage.qml"</span>
}
...
<span class="type"><a href="../qtqml/qml-qtqml-models-listelement.html">ListElement</a></span> {
<span class="name">title</span>: <span class="name">qsTr</span>(<span class="string">"Settings"</span>)
<span class="name">icon</span>: <span class="string">"Settings/images/settings.png"</span>
<span class="name">page</span>: <span class="string">"Settings/SettingsPage.qml"</span>
}
}
<span class="name">delegate</span>: <span class="name">QQC2</span>.AbstractButton {
...
<span class="name">onClicked</span>: {
<span class="keyword">if</span> (<span class="name">PathView</span>.<span class="name">isCurrentItem</span>)
<span class="name">circularView</span>.<span class="name">launched</span>(<span class="name">Qt</span>.<span class="name">resolvedUrl</span>(<span class="name">page</span>))
<span class="keyword">else</span>
<span class="name">circularView</span>.<span class="name">currentIndex</span> <span class="operator">=</span> <span class="name">index</span>
}
}
...
}
</pre>
<a name="applications"></a>
<h2 id="applications">Applications</h2>
<p>The applications are designed for touch input based on what input methods or communication means are typically offered by wearable devices.</p>
<p>Most applications have their own JavaScript files that act as dummy application backends. They illustrate fetching external data and help manipulating or converting the data. In the <code>Navigation</code> and <code>Weather</code> applications, data acquisition is implemented using <a href="../qtqml/qtqml-javascript-qmlglobalobject.html#xmlhttprequest">XMLHttpRequest</a> 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 real remote servers.</p>
<a name="navigation"></a>
<h3 >Navigation</h3>
<p>This application displays a walking route from source to destination. This route is obtained as a response by invoking an API provided by <a href="https://www.openstreetmap.org/">https://www.openstreetmap.org/</a>. The response is in JSON format and the corresponding JavaScript file associated with the application helps interpret the response. Currently, it is not possible to specify the source and destination from within the application, 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.</p>
<a name="weather"></a>
<h3 >Weather</h3>
<p>This application displays weather information such as temperature, sunrise and sunset times, air pressure, and so on. This information is obtained as a response to invoking <a href="https://openweathermap.org/">https://openweathermap.org/</a>. The response is in JSON format and the corresponding JavaScript file associated with the application helps interpret the response. As with the Navigation application, this application can be modified by adding screens to accept location information to obtain weather data for a given location.</p>
<a name="world-clock"></a>
<h3 >World Clock</h3>
<p>This application displays a world clock for different cities. As of now, the list of cities is hard-coded in the application, but that can be changed based on the input capabilities of the device.</p>
<a name="others"></a>
<h3 >Others</h3>
<p>The remaining applications return static data for now, but they can easily be modified to process response data obtained from respective services.</p>
<a name="running-the-example"></a>
<h2 id="running-the-example">Running the Example</h2>
<p>To run the example from Qt Creator, open the <b>Welcome</b> mode and select the example from <b>Examples</b>. For more information, visit Building and Running an Example.</p>
<p>Files:</p>
<ul>
<li><a href="qtquickcontrols2-wearable-wearable-cpp.html">wearable/wearable.cpp</a></li>
<li><a href="qtquickcontrols2-wearable-wearable-qml.html">wearable/wearable.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-launcherpage-qml.html">wearable/qml/LauncherPage.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-navibutton-qml.html">wearable/qml/NaviButton.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-alarms-alarmspage-qml.html">wearable/qml/Alarms/AlarmsPage.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-fitness-fitnesspage-qml.html">wearable/qml/Fitness/FitnessPage.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-fitness-fitness-js.html">wearable/qml/Fitness/fitness.js</a></li>
<li><a href="qtquickcontrols2-wearable-qml-navigation-navigationpage-qml.html">wearable/qml/Navigation/NavigationPage.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-navigation-routeelement-qml.html">wearable/qml/Navigation/RouteElement.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-navigation-navigation-js.html">wearable/qml/Navigation/navigation.js</a></li>
<li><a href="qtquickcontrols2-wearable-qml-notifications-notificationspage-qml.html">wearable/qml/Notifications/NotificationsPage.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-notifications-notifications-js.html">wearable/qml/Notifications/notifications.js</a></li>
<li><a href="qtquickcontrols2-wearable-qml-settings-settingspage-qml.html">wearable/qml/Settings/SettingsPage.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-style-pageindicator-qml.html">wearable/qml/Style/PageIndicator.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-style-slider-qml.html">wearable/qml/Style/Slider.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-style-switch-qml.html">wearable/qml/Style/Switch.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-style-uistyle-qml.html">wearable/qml/Style/UIStyle.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-weather-weatherpage-qml.html">wearable/qml/Weather/WeatherPage.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-weather-weather-js.html">wearable/qml/Weather/weather.js</a></li>
<li><a href="qtquickcontrols2-wearable-qml-worldclock-clock-qml.html">wearable/qml/WorldClock/Clock.qml</a></li>
<li><a href="qtquickcontrols2-wearable-qml-worldclock-worldclockpage-qml.html">wearable/qml/WorldClock/WorldClockPage.qml</a></li>
<li><a href="qtquickcontrols2-wearable-wearable-pro.html">wearable/wearable.pro</a></li>
<li><a href="qtquickcontrols2-wearable-wearable-qrc.html">wearable/wearable.qrc</a></li>
<li><a href="qtquickcontrols2-wearable-qml-style-qmldir.html">wearable/qml/Style/qmldir</a></li>
</ul>
<p>Images:</p>
<ul>
<li><a href="images/used-in-examples/wearable/images/back.png">wearable/images/back.png</a></li>
<li><a href="images/used-in-examples/wearable/images/back@2x.png">wearable/images/back@2x.png</a></li>
<li><a href="images/used-in-examples/wearable/images/back@3x.png">wearable/images/back@3x.png</a></li>
<li><a href="images/used-in-examples/wearable/images/back@4x.png">wearable/images/back@4x.png</a></li>
<li><a href="images/used-in-examples/wearable/images/background.png">wearable/images/background.png</a></li>
<li><a href="images/used-in-examples/wearable/images/home.png">wearable/images/home.png</a></li>
<li><a href="images/used-in-examples/wearable/images/home@2x.png">wearable/images/home@2x.png</a></li>
<li><a href="images/used-in-examples/wearable/images/home@3x.png">wearable/images/home@3x.png</a></li>
<li><a href="images/used-in-examples/wearable/images/home@4x.png">wearable/images/home@4x.png</a></li>
</ul>
</div>
<!-- @@@wearable -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|