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 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qdeclarativeengine.cpp -->
<title>Qt 4.8: QML Qt Element</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="qdeclarativeelements.html">QML Elements</a></li>
<li>QML Qt Element</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#methods">Methods</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#enums">Enums</a></li>
<li class="level2"><a href="#types">Types</a></li>
<li class="level2"><a href="#date-time-formatters">Date/Time Formatters</a></li>
<li class="level2"><a href="#dynamic-object-creation">Dynamic Object Creation</a></li>
</ul>
</div>
<h1 class="title">QML Qt Element</h1>
<span class="subtitle"></span>
<!-- $$$QML:Qt-brief -->
<p>The QML global Qt object provides useful enums and functions from Qt. <a href="#details">More...</a></p>
<!-- @@@QML:Qt -->
<ul>
<li><a href="qml-qt-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qt.html#application-prop">application</a></b></b> : object</li>
</ul>
<a name="methods"></a>
<h2>Methods</h2>
<ul>
<li class="fn"><b><b><a href="qml-qt.html#atob-method">atob</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#btoa-method">btoa</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#createComponent-method">createComponent</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#createQmlObject-method">createQmlObject</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#darker-method">darker</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#fontFamilies-method">fontFamilies</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#formatDate-method">formatDate</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#formatDateTime-method">formatDateTime</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#formatTime-method">formatTime</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#hsla-method">hsla</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#include-method">include</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#isQtObject-method">isQtObject</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#lighter-method">lighter</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#md5-method">md5</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#openUrlExternally-method">openUrlExternally</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#point-method">point</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#quit-method">quit</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#rect-method">rect</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#resolvedUrl-method">resolvedUrl</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#rgba-method">rgba</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#size-method">size</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#tint-method">tint</a></b></b></li>
<li class="fn"><b><b><a href="qml-qt.html#vector3d-method">vector3d</a></b></b></li>
</ul>
<!-- $$$QML:Qt-description -->
<a name="details"></a>
<h2>Detailed Description</h2>
<a name="qmlglobalqtobject"></a><p>The <tt>Qt</tt> object is a global object with utility functions, properties and enums.</p>
<p>It is not instantiable; to use it, call the members of the global <tt>Qt</tt> object directly. For example:</p>
<pre class="qml"> import QtQuick 1.0
<span class="type"><a href="qml-text.html">Text</a></span> {
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>)
<span class="name">text</span>: <span class="name">Qt</span>.<span class="name">md5</span>(<span class="string">"hello, world"</span>)
}</pre>
<a name="enums"></a>
<h2>Enums</h2>
<p>The Qt object contains the enums available in the <a href="qt.html#qt-namespace">Qt Namespace</a>. For example, you can access the <a href="qt.html#MouseButton-enum">Qt::LeftButton</a> and <a href="qt.html#MouseButton-enum">Qt::RightButton</a> enum values as <tt>Qt.LeftButton</tt> and <tt>Qt.RightButton</tt>.</p>
<a name="types"></a>
<h2>Types</h2>
<p>The Qt object also contains helper functions for creating objects of specific data types. This is primarily useful when setting the properties of an item when the property has one of the following types:</p>
<ul>
<li><tt>color</tt> - use <a href="qml-qt.html#rgba-method">Qt.rgba()</a>, <a href="qml-qt.html#hsla-method">Qt.hsla()</a>, <a href="qml-qt.html#darker-method">Qt.darker()</a>, <a href="qml-qt.html#lighter-method">Qt.lighter()</a> or <a href="qml-qt.html#tint-method">Qt.tint()</a></li>
<li><tt>rect</tt> - use <a href="qml-qt.html#rect-method">Qt.rect()</a></li>
<li><tt>point</tt> - use <a href="qml-qt.html#point-method">Qt.point()</a></li>
<li><tt>size</tt> - use <a href="qml-qt.html#size-method">Qt.size()</a></li>
<li><tt>vector3d</tt> - use <a href="qml-qt.html#vector3d-method">Qt.vector3d()</a></li>
</ul>
<p>There are also string based constructors for these types. See <a href="qdeclarativebasictypes.html">QML Basic Types</a> for more information.</p>
<a name="date-time-formatters"></a>
<h2>Date/Time Formatters</h2>
<p>The Qt object contains several functions for formatting <a href="qdatetime.html">QDateTime</a>, <a href="qdate.html">QDate</a> and <a href="qtime.html">QTime</a> values.</p>
<ul>
<li><a href="qml-qt.html#formatDateTime-method">string Qt.formatDateTime(datetime date, variant format)</a></li>
<li><a href="qml-qt.html#formatDate-method">string Qt.formatDate(datetime date, variant format)</a></li>
<li><a href="qml-qt.html#formatTime-method">string Qt.formatTime(datetime date, variant format)</a></li>
</ul>
<p>The format specification is described at <a href="qml-qt.html#formatDateTime-method">Qt.formatDateTime</a>.</p>
<a name="dynamic-object-creation"></a>
<h2>Dynamic Object Creation</h2>
<p>The following functions on the global object allow you to dynamically create QML items from files or strings. See <a href="qdeclarativedynamicobjects.html">Dynamic Object Management in QML</a> for an overview of their use.</p>
<ul>
<li><a href="qml-qt.html#createComponent-method">object Qt.createComponent(url)</a></li>
<li><a href="qml-qt.html#createQmlObject-method">object Qt.createQmlObject(string qml, object parent, string filepath)</a></li>
</ul>
<!-- @@@QML:Qt -->
<h2>Property Documentation</h2>
<!-- $$$application -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="application-prop"></a><span class="qmlreadonly">read-only</span><span class="name">application</span> : <span class="type">object</span></p></td></tr></table></div><div class="qmldoc"><p>The <tt>application</tt> object provides access to global application state properties shared by many QML components.</p>
<p>Its properties are:</p>
<table class="generic">
<tr valign="top" class="odd"><td ><tt>application.active</tt></td><td >This read-only property indicates whether the application is the top-most and focused application, and the user is able to interact with the application. The property is false when the application is in the background, the device keylock or screen saver is active, the screen backlight is turned off, or the global system dialog is being displayed on top of the application. It can be used for stopping and pausing animations, timers and active processing of data in order to save device battery power and free device memory and processor load when the application is not active.</td></tr>
<tr valign="top" class="even"><td ><tt>application.layoutDirection</tt></td><td >This read-only property can be used to query the default layout direction of the application. On system start-up, the default layout direction depends on the application's language. The property has a value of <tt>Qt.RightToLeft</tt> in locales where text and graphic elements are read from right to left, and <tt>Qt.LeftToRight</tt> where the reading direction flows from left to right. You can bind to this property to customize your application layouts to support both layout directions.<p>Possible values are:</p>
<ul>
<li>Qt.LeftToRight - Text and graphics elements should be positioned from left to right.</li>
<li>Qt.RightToLeft - Text and graphics elements should be positioned from right to left.</li>
</ul>
</td></tr>
</table>
<p>The following example uses the <tt>application</tt> object to indicate whether the application is currently active:</p>
<pre class="qml"> import QtQuick 1.1
<span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
<span class="name">width</span>: <span class="number">300</span>; <span class="name">height</span>: <span class="number">55</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">application</span>.<span class="name">active</span> ? <span class="string">"white"</span> : <span class="string">"lightgray"</span>
<span class="type"><a href="qml-text.html">Text</a></span> {
<span class="name">text</span>: <span class="string">"Application "</span> <span class="operator">+</span> (<span class="name">Qt</span>.<span class="name">application</span>.<span class="name">active</span> ? <span class="string">"active"</span> : <span class="string">"inactive"</span>)
<span class="name">opacity</span>: <span class="name">Qt</span>.<span class="name">application</span>.<span class="name">active</span> ? <span class="number">1.0</span> : <span class="number">0.5</span>
<span class="name">anchors</span>.centerIn: <span class="name">parent</span>
}
}</pre>
<p>This property group was introduced in QtQuick 1.1.</p>
</div></div><!-- @@@application -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$atob -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="atob-method"></a><span class="type"><a href="qml-string.html">string</a></span> Qt::<span class="name">atob</span> ( <span class="type">data</span> )</p></td></tr></table></div><div class="qmldoc"><p>ASCII to binary - this function returns a base64 decoding of <tt>data</tt>.</p>
</div></div><!-- @@@atob -->
<br/>
<!-- $$$btoa -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="btoa-method"></a><span class="type"><a href="qml-string.html">string</a></span> Qt::<span class="name">btoa</span> ( <span class="type">data</span> )</p></td></tr></table></div><div class="qmldoc"><p>Binary to ASCII - this function returns a base64 encoding of <tt>data</tt>.</p>
</div></div><!-- @@@btoa -->
<br/>
<!-- $$$createComponent -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="createComponent-method"></a><span class="type">object</span> Qt::<span class="name">createComponent</span> ( <span class="type"><a href="qml-url.html">url</a></span> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a <a href="qml-component.html">Component</a> object created using the QML file at the specified <i>url</i>, or <tt>null</tt> if an empty string was given.</p>
<p>The returned component's <a href="qml-component.html#status-prop">Component::status</a> property indicates whether the component was successfully created. If the status is <tt>Component.Error</tt>, see <a href="qml-component.html#errorString-method">Component::errorString()</a> for an error description.</p>
<p>Call <a href="qml-component.html#createObject-method">Component.createObject()</a> on the returned component to create an object instance of the component.</p>
<p>For example:</p>
<pre class="qml"> import QtQuick 1.0
<span class="type"><a href="qml-item.html">Item</a></span> {
<span class="name">id</span>: <span class="name">container</span>
<span class="name">width</span>: <span class="number">300</span>; <span class="name">height</span>: <span class="number">300</span>
<span class="keyword">function</span> <span class="name">loadButton</span>() {
var <span class="name">component</span> = <span class="name">Qt</span>.<span class="name">createComponent</span>(<span class="string">"Button.qml"</span>);
<span class="keyword">if</span> (<span class="name">component</span>.<span class="name">status</span> <span class="operator">==</span> <span class="name">Component</span>.<span class="name">Ready</span>) {
var <span class="name">button</span> = <span class="name">component</span>.<span class="name">createObject</span>(<span class="name">container</span>);
<span class="name">button</span>.<span class="name">color</span> <span class="operator">=</span> <span class="string">"red"</span>;
}
}
<span class="name">Component</span>.onCompleted: <span class="name">loadButton</span>()
}</pre>
<p>See <a href="qdeclarativedynamicobjects.html">Dynamic Object Management in QML</a> for more information on using this function.</p>
<p>To create a QML object from an arbitrary string of QML (instead of a file), use <a href="qml-qt.html#createQmlObject-method">Qt.createQmlObject()</a>.</p>
</div></div><!-- @@@createComponent -->
<br/>
<!-- $$$createQmlObject -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="createQmlObject-method"></a><span class="type">object</span> Qt::<span class="name">createQmlObject</span> ( <span class="type"><a href="qml-string.html">string</a></span> <i>qml</i>, <span class="type">object</span> <i>parent</i>, <span class="type"><a href="qml-string.html">string</a></span> <i>filepath</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a new object created from the given <i>string</i> of QML which will have the specified <i>parent</i>, or <tt>null</tt> if there was an error in creating the object.</p>
<p>If <i>filepath</i> is specified, it will be used for error reporting for the created object.</p>
<p>Example (where <tt>parentItem</tt> is the id of an existing QML item):</p>
<pre class="qml"> var <span class="name">newObject</span> = <span class="name">Qt</span>.<span class="name">createQmlObject</span>(<span class="string">'import QtQuick 1.0; Rectangle {color: "red"; width: 20; height: 20}'</span>,
<span class="name">parentItem</span>, <span class="string">"dynamicSnippet1"</span>);</pre>
<p>In the case of an error, a <a href="qtscript.html">QtScript</a> Error object is thrown. This object has an additional property, <tt>qmlErrors</tt>, which is an array of the errors encountered. Each object in this array has the members <tt>lineNumber</tt>, <tt>columnNumber</tt>, <tt>fileName</tt> and <tt>message</tt>. For example, if the above snippet had misspelled color as 'colro' then the array would contain an object like the following: { "lineNumber" : 1, "columnNumber" : 32, "fileName" : "dynamicSnippet1", "message" : "Cannot assign to non-existent property "colro""}.</p>
<p>Note that this function returns immediately, and therefore may not work if the <i>qml</i> string loads new components (that is, external QML files that have not yet been loaded). If this is the case, consider using <a href="qml-qt.html#createComponent-method">Qt.createComponent()</a> instead.</p>
<p>See <a href="qdeclarativedynamicobjects.html">Dynamic Object Management in QML</a> for more information on using this function.</p>
</div></div><!-- @@@createQmlObject -->
<br/>
<!-- $$$darker -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="darker-method"></a><span class="type"><a href="qml-color.html">color</a></span> Qt::<span class="name">darker</span> ( <span class="type"><a href="qml-color.html">color</a></span> <i>baseColor</i>, <span class="type"><a href="qml-real.html">real</a></span> <i>factor</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a color darker than <tt>baseColor</tt> by the <tt>factor</tt> provided.</p>
<p>If the factor is greater than 1.0, this function returns a darker color. Setting factor to 3.0 returns a color that has one-third the brightness. If the factor is less than 1.0, the return color is lighter, but we recommend using the Qt.<a href="qml-qt.html#lighter-method">lighter()</a> function for this purpose. If the factor is 0 or negative, the return value is unspecified.</p>
<p>The function converts the current RGB color to HSV, divides the value (V) component by factor and converts the color back to RGB.</p>
<p>If <tt>factor</tt> is not supplied, returns a color 50% darker than <tt>baseColor</tt> (factor 2.0).</p>
</div></div><!-- @@@darker -->
<br/>
<!-- $$$fontFamilies -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="fontFamilies-method"></a><span class="type"><a href="qml-list.html">list</a></span><<span class="type"><a href="qml-string.html">string</a></span>> Qt::<span class="name">fontFamilies</span> ()</p></td></tr></table></div><div class="qmldoc"><p>Returns a list of the font families available to the application.</p>
</div></div><!-- @@@fontFamilies -->
<br/>
<!-- $$$formatDate -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="formatDate-method"></a><span class="type"><a href="qml-string.html">string</a></span> Qt::<span class="name">formatDate</span> ( <span class="type">datetime</span> <i>date</i>, <span class="type"><a href="qml-variant.html">variant</a></span> <i>format</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a string representation of <tt>date</tt>, optionally formatted according to <tt>format</tt>.</p>
<p>The <i>date</i> parameter may be a JavaScript <tt>Date</tt> object, a <a href="qml-date.html">date</a> property, a <a href="qdate.html">QDate</a>, or <a href="qdatetime.html">QDateTime</a> value. The <i>format</i> parameter may be any of the possible format values as described for <a href="qml-qt.html#formatDateTime-method">Qt.formatDateTime()</a>.</p>
<p>If <i>format</i> is not specified, <i>date</i> is formatted using <a href="qt.html#DateFormat-enum">Qt.DefaultLocaleShortDate</a>.</p>
</div></div><!-- @@@formatDate -->
<br/>
<!-- $$$formatDateTime -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="formatDateTime-method"></a><span class="type"><a href="qml-string.html">string</a></span> Qt::<span class="name">formatDateTime</span> ( <span class="type">datetime</span> <i>dateTime</i>, <span class="type"><a href="qml-variant.html">variant</a></span> <i>format</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a string representation of <tt>datetime</tt>, optionally formatted according to <tt>format</tt>.</p>
<p>The <i>date</i> parameter may be a JavaScript <tt>Date</tt> object, a <a href="qml-date.html">date</a> property, a <a href="qdate.html">QDate</a>, <a href="qtime.html">QTime</a>, or <a href="qdatetime.html">QDateTime</a> value.</p>
<p>If <i>format</i> is not provided, <i>dateTime</i> is formatted using <a href="qt.html#DateFormat-enum">Qt.DefaultLocaleShortDate</a>. Otherwise, <i>format</i> should be either.</p>
<ul>
<li>One of the <a href="qt.html#DateFormat-enum">Qt::DateFormat</a> enumeration values, such as <tt>Qt.DefaultLocaleShortDate</tt> or <tt>Qt.ISODate</tt></li>
<li>A string that specifies the format of the returned string, as detailed below.</li>
</ul>
<p>If <i>format</i> specifies a format string, it should use the following expressions to specify the date:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Expression</th><th >Output</th></tr></thead>
<tr valign="top" class="odd"><td >d</td><td >the day as number without a leading zero (1 to 31)</td></tr>
<tr valign="top" class="even"><td >dd</td><td >the day as number with a leading zero (01 to 31)</td></tr>
<tr valign="top" class="odd"><td >ddd</td><td >the abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses <a href="qdate.html#shortDayName">QDate::shortDayName()</a>.</td></tr>
<tr valign="top" class="even"><td >dddd</td><td >the long localized day name (e.g. 'Monday' to '<a href="qt.html#DayOfWeek-enum">Qt::Sunday</a>'). Uses <a href="qdate.html#longDayName">QDate::longDayName()</a>.</td></tr>
<tr valign="top" class="odd"><td >M</td><td >the month as number without a leading zero (1-12)</td></tr>
<tr valign="top" class="even"><td >MM</td><td >the month as number with a leading zero (01-12)</td></tr>
<tr valign="top" class="odd"><td >MMM</td><td >the abbreviated localized month name (e.g. 'Jan' to 'Dec'). Uses <a href="qdate.html#shortMonthName">QDate::shortMonthName()</a>.</td></tr>
<tr valign="top" class="even"><td >MMMM</td><td >the long localized month name (e.g. 'January' to 'December'). Uses <a href="qdate.html#longMonthName">QDate::longMonthName()</a>.</td></tr>
<tr valign="top" class="odd"><td >yy</td><td >the year as two digit number (00-99)</td></tr>
<tr valign="top" class="even"><td >yyyy</td><td >the year as four digit number</td></tr>
</table>
<p>In addition the following expressions can be used to specify the time:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Expression</th><th >Output</th></tr></thead>
<tr valign="top" class="odd"><td >h</td><td >the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)</td></tr>
<tr valign="top" class="even"><td >hh</td><td >the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)</td></tr>
<tr valign="top" class="odd"><td >m</td><td >the minute without a leading zero (0 to 59)</td></tr>
<tr valign="top" class="even"><td >mm</td><td >the minute with a leading zero (00 to 59)</td></tr>
<tr valign="top" class="odd"><td >s</td><td >the second without a leading zero (0 to 59)</td></tr>
<tr valign="top" class="even"><td >ss</td><td >the second with a leading zero (00 to 59)</td></tr>
<tr valign="top" class="odd"><td >z</td><td >the milliseconds without leading zeroes (0 to 999)</td></tr>
<tr valign="top" class="even"><td >zzz</td><td >the milliseconds with leading zeroes (000 to 999)</td></tr>
<tr valign="top" class="odd"><td >AP</td><td >use AM/PM display. <i>AP</i> will be replaced by either "AM" or "PM".</td></tr>
<tr valign="top" class="even"><td >ap</td><td >use am/pm display. <i>ap</i> will be replaced by either "am" or "pm".</td></tr>
</table>
<p>All other input characters will be ignored. Any sequence of characters that are enclosed in single quotes will be treated as text and not be used as an expression. Two consecutive single quotes ("''") are replaced by a single quote in the output.</p>
<p>For example, if the following date/time value was specified:</p>
<pre class="cpp"> <span class="comment">// 21 May 2001 14:13:09</span>
var dateTime <span class="operator">=</span> <span class="keyword">new</span> Date(<span class="number">2001</span><span class="operator">,</span> <span class="number">5</span><span class="operator">,</span> <span class="number">21</span><span class="operator">,</span> <span class="number">14</span><span class="operator">,</span> <span class="number">13</span><span class="operator">,</span> <span class="number">09</span>)</pre>
<p>This <i>dateTime</i> value could be passed to <tt>Qt.formatDateTime()</tt>, <a href="qml-qt.html#formatDate-method">Qt.formatDate()</a> or <a href="qml-qt.html#formatTime-method">Qt.formatTime()</a> with the <i>format</i> values below to produce the following results:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Format</th><th >Result</th></tr></thead>
<tr valign="top" class="odd"><td >"dd.MM.yyyy"</td><td >21.05.2001</td></tr>
<tr valign="top" class="even"><td >"ddd MMMM d yy"</td><td >Tue May 21 01</td></tr>
<tr valign="top" class="odd"><td >"hh:mm:ss.zzz"</td><td >14:13:09.042</td></tr>
<tr valign="top" class="even"><td >"h:m:s ap"</td><td >2:13:9 pm</td></tr>
</table>
</div></div><!-- @@@formatDateTime -->
<br/>
<!-- $$$formatTime -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="formatTime-method"></a><span class="type"><a href="qml-string.html">string</a></span> Qt::<span class="name">formatTime</span> ( <span class="type">datetime</span> <i>time</i>, <span class="type"><a href="qml-variant.html">variant</a></span> <i>format</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a string representation of <tt>time</tt>, optionally formatted according to <tt>format</tt>.</p>
<p>The <i>time</i> parameter may be a JavaScript <tt>Date</tt> object, a <a href="qtime.html">QTime</a>, or <a href="qdatetime.html">QDateTime</a> value. The <i>format</i> parameter may be any of the possible format values as described for <a href="qml-qt.html#formatDateTime-method">Qt.formatDateTime()</a>.</p>
<p>If <i>format</i> is not specified, <i>time</i> is formatted using <a href="qt.html#DateFormat-enum">Qt.DefaultLocaleShortDate</a>.</p>
</div></div><!-- @@@formatTime -->
<br/>
<!-- $$$hsla -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="hsla-method"></a><span class="type"><a href="qml-color.html">color</a></span> Qt::<span class="name">hsla</span> ( <span class="type"><a href="qml-real.html">real</a></span> <i>hue</i>, <span class="type"><a href="qml-real.html">real</a></span> <i>saturation</i>, <span class="type"><a href="qml-real.html">real</a></span> <i>lightness</i>, <span class="type"><a href="qml-real.html">real</a></span> <i>alpha</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a color with the specified <tt>hue</tt>, <tt>saturation</tt>, <tt>lightness</tt> and <tt>alpha</tt> components. All components should be in the range 0-1 inclusive.</p>
</div></div><!-- @@@hsla -->
<br/>
<!-- $$$include -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="include-method"></a><span class="type">object</span> Qt::<span class="name">include</span> ( <span class="type"><a href="qml-string.html">string</a></span> <i>url</i>, <span class="type">jsobject</span> <i>callback</i> )</p></td></tr></table></div><div class="qmldoc"><p>Includes another JavaScript file. This method can only be used from within JavaScript files, and not regular QML files.</p>
<p>This imports all functions from <i>url</i> into the current script's namespace.</p>
<p>Qt.include() returns an object that describes the status of the operation. The object has a single property, <tt>status</tt>, that is set to one of the following values:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Symbol</th><th >Value</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td >result.OK</td><td >0</td><td >The include completed successfully.</td></tr>
<tr valign="top" class="even"><td >result.LOADING</td><td >1</td><td >Data is being loaded from the network.</td></tr>
<tr valign="top" class="odd"><td >result.NETWORK_ERROR</td><td >2</td><td >A network error occurred while fetching the url.</td></tr>
<tr valign="top" class="even"><td >result.EXCEPTION</td><td >3</td><td >A JavaScript exception occurred while executing the included code. An additional <tt>exception</tt> property will be set in this case.</td></tr>
</table>
<p>The <tt>status</tt> property will be updated as the operation progresses.</p>
<p>If provided, <i>callback</i> is invoked when the operation completes. The callback is passed the same object as is returned from the Qt.include() call.</p>
</div></div><!-- @@@include -->
<br/>
<!-- $$$isQtObject -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="isQtObject-method"></a><span class="type"><a href="qml-bool.html">bool</a></span> Qt::<span class="name">isQtObject</span> ( <span class="type">object</span> )</p></td></tr></table></div><div class="qmldoc"><p>Returns true if <tt>object</tt> is a valid reference to a Qt or QML object, otherwise false.</p>
</div></div><!-- @@@isQtObject -->
<br/>
<!-- $$$lighter -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="lighter-method"></a><span class="type"><a href="qml-color.html">color</a></span> Qt::<span class="name">lighter</span> ( <span class="type"><a href="qml-color.html">color</a></span> <i>baseColor</i>, <span class="type"><a href="qml-real.html">real</a></span> <i>factor</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a color lighter than <tt>baseColor</tt> by the <tt>factor</tt> provided.</p>
<p>If the factor is greater than 1.0, this functions returns a lighter color. Setting factor to 1.5 returns a color that is 50% brighter. If the factor is less than 1.0, the return color is darker, but we recommend using the Qt.<a href="qml-qt.html#darker-method">darker()</a> function for this purpose. If the factor is 0 or negative, the return value is unspecified.</p>
<p>The function converts the current RGB color to HSV, multiplies the value (V) component by factor and converts the color back to RGB.</p>
<p>If <tt>factor</tt> is not supplied, returns a color 50% lighter than <tt>baseColor</tt> (factor 1.5).</p>
</div></div><!-- @@@lighter -->
<br/>
<!-- $$$md5 -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="md5-method"></a><span class="type"><a href="qml-string.html">string</a></span> Qt::<span class="name">md5</span> ( <span class="type">data</span> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a hex string of the md5 hash of <tt>data</tt>.</p>
</div></div><!-- @@@md5 -->
<br/>
<!-- $$$openUrlExternally -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="openUrlExternally-method"></a><span class="type"><a href="qml-bool.html">bool</a></span> Qt::<span class="name">openUrlExternally</span> ( <span class="type"><a href="qml-url.html">url</a></span> <i>target</i> )</p></td></tr></table></div><div class="qmldoc"><p>Attempts to open the specified <tt>target</tt> url in an external application, based on the user's desktop preferences. Returns true if it succeeds, and false otherwise.</p>
</div></div><!-- @@@openUrlExternally -->
<br/>
<!-- $$$point -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="point-method"></a><span class="type"><a href="qml-qt.html#point-method">point</a></span> Qt::<span class="name">point</span> ( <span class="type"><a href="qml-int.html">int</a></span> <i>x</i>, <span class="type"><a href="qml-int.html">int</a></span> <i>y</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a Point with the specified <tt>x</tt> and <tt>y</tt> coordinates.</p>
</div></div><!-- @@@point -->
<br/>
<!-- $$$quit -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="quit-method"></a>Qt::<span class="name">quit</span> ()</p></td></tr></table></div><div class="qmldoc"><p>This function causes the <a href="qdeclarativeengine.html#quit">QDeclarativeEngine::quit()</a> signal to be emitted. Within the <a href="qmlviewer.html">QML Viewer</a>, this causes the launcher application to exit; to quit a C++ application when this method is called, connect the <a href="qdeclarativeengine.html#quit">QDeclarativeEngine::quit()</a> signal to the <a href="qcoreapplication.html#quit">QCoreApplication::quit()</a> slot.</p>
</div></div><!-- @@@quit -->
<br/>
<!-- $$$rect -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="rect-method"></a><span class="type"><a href="qml-qt.html#rect-method">rect</a></span> Qt::<span class="name">rect</span> ( <span class="type"><a href="qml-int.html">int</a></span> <i>x</i>, <span class="type"><a href="qml-int.html">int</a></span> <i>y</i>, <span class="type"><a href="qml-int.html">int</a></span> <i>width</i>, <span class="type"><a href="qml-int.html">int</a></span> <i>height</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a <tt>rect</tt> with the top-left corner at <tt>x</tt>, <tt>y</tt> and the specified <tt>width</tt> and <tt>height</tt>.</p>
<p>The returned object has <tt>x</tt>, <tt>y</tt>, <tt>width</tt> and <tt>height</tt> attributes with the given values.</p>
</div></div><!-- @@@rect -->
<br/>
<!-- $$$resolvedUrl -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="resolvedUrl-method"></a><span class="type"><a href="qml-url.html">url</a></span> Qt::<span class="name">resolvedUrl</span> ( <span class="type"><a href="qml-url.html">url</a></span> <i>url</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns <i>url</i> resolved relative to the URL of the caller.</p>
</div></div><!-- @@@resolvedUrl -->
<br/>
<!-- $$$rgba -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="rgba-method"></a><span class="type"><a href="qml-color.html">color</a></span> Qt::<span class="name">rgba</span> ( <span class="type"><a href="qml-real.html">real</a></span> <i>red</i>, <span class="type"><a href="qml-real.html">real</a></span> <i>green</i>, <span class="type"><a href="qml-real.html">real</a></span> <i>blue</i>, <span class="type"><a href="qml-real.html">real</a></span> <i>alpha</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a color with the specified <tt>red</tt>, <tt>green</tt>, <tt>blue</tt> and <tt>alpha</tt> components. All components should be in the range 0-1 inclusive.</p>
</div></div><!-- @@@rgba -->
<br/>
<!-- $$$size -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="size-method"></a>Qt::<span class="name">size</span> ( <span class="type"><a href="qml-int.html">int</a></span> <i>width</i>, <span class="type"><a href="qml-int.html">int</a></span> <i>height</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a Size with the specified <tt>width</tt> and <tt>height</tt>.</p>
</div></div><!-- @@@size -->
<br/>
<!-- $$$tint -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="tint-method"></a><span class="type"><a href="qml-color.html">color</a></span> Qt::<span class="name">tint</span> ( <span class="type"><a href="qml-color.html">color</a></span> <i>baseColor</i>, <span class="type"><a href="qml-color.html">color</a></span> <i>tintColor</i> )</p></td></tr></table></div><div class="qmldoc"><p>This function allows tinting one color with another.</p>
<p>The tint color should usually be mostly transparent, or you will not be able to see the underlying color. The below example provides a slight red tint by having the tint color be pure red which is only 1/16th opaque.</p>
<pre class="qml"> <span class="type"><a href="qml-item.html">Item</a></span> {
<span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
<span class="name">x</span>: <span class="number">0</span>; <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>
<span class="name">color</span>: <span class="string">"lightsteelblue"</span>
}
<span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
<span class="name">x</span>: <span class="number">100</span>; <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">tint</span>(<span class="string">"lightsteelblue"</span>, <span class="string">"#10FF0000"</span>)
}
}</pre>
<p class="centerAlign"><img src="images/declarative-rect_tint.png" alt="" /></p><p>Tint is most useful when a subtle change is intended to be conveyed due to some event; you can then use tinting to more effectively tune the visible color.</p>
</div></div><!-- @@@tint -->
<br/>
<!-- $$$vector3d -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlFuncNode"><p><a name="vector3d-method"></a>Qt::<span class="name">vector3d</span> ( <span class="type"><a href="qml-real.html">real</a></span> <i>x</i>, <span class="type"><a href="qml-real.html">real</a></span> <i>y</i>, <span class="type"><a href="qml-real.html">real</a></span> <i>z</i> )</p></td></tr></table></div><div class="qmldoc"><p>Returns a <a href="qml-vector3d.html">Vector3D</a> with the specified <tt>x</tt>, <tt>y</tt> and <tt>z</tt>.</p>
</div></div><!-- @@@vector3d -->
<br/>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
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.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|