Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 5090

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?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" />
<!-- globalobject.qdoc -->
  <title>Qt 4.8: QML Global Object</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li>QML Global Object</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#qt-object">Qt Object</a></li>
<li class="level1"><a href="#xmlhttprequest">XMLHttpRequest</a></li>
<li class="level1"><a href="#offline-storage-api">Offline Storage API</a></li>
<li class="level2"><a href="#database-api">Database API</a></li>
<li class="level3"><a href="#db-opendatabasesync-identifier-version-description-estimated-size-callback-db">db = openDatabaseSync(identifier, version, description, estimated_size, callback(db))</a></li>
<li class="level3"><a href="#db-changeversion-from-to-callback-tx">db.changeVersion(from, to, callback(tx))</a></li>
<li class="level3"><a href="#db-transaction-callback-tx">db.transaction(callback(tx))</a></li>
<li class="level3"><a href="#db-readtransaction-callback-tx">db.readTransaction(callback(tx))</a></li>
<li class="level3"><a href="#results-tx-executesql-statement-values">results = tx.executeSql(statement, values)</a></li>
<li class="level1"><a href="#logging">Logging</a></li>
</ul>
</div>
<h1 class="title">QML Global Object</h1>
<span class="subtitle"></span>
<!-- $$$qdeclarativeglobalobject.html-description -->
<div class="descr"> <a name="details"></a>
<p>Contains all the properties of the JavaScript global object, plus:</p>
<a name="qt-object"></a>
<h2>Qt Object</h2>
<p>The <a href="qml-qt.html#qmlglobalqtobject">Qt object</a> provides useful enums and functions from Qt, for use in all QML files.</p>
<a name="xmlhttprequest"></a>
<h2>XMLHttpRequest</h2>
<a name="xmlhttprequest"></a><p>QML script supports the <a href="#xmlhttprequest">XMLHttpRequest</a> object, which can be used to asynchronously obtain data from over a network.</p>
<p>The <a href="#xmlhttprequest">XMLHttpRequest</a> API implements the same <a href="http://www.w3.org/TR/XMLHttpRequest/">W3C standard</a> as many popular web browsers with following exceptions:</p>
<ul>
<li>QML's <a href="#xmlhttprequest">XMLHttpRequest</a> does not enforce the same origin policy.</li>
<li>QML's <a href="#xmlhttprequest">XMLHttpRequest</a> does not support <i>synchronous</i> requests.</li>
</ul>
<p>Additionally, the <tt>responseXML</tt> XML DOM tree currently supported by QML is a reduced subset of the <a href="http://www.w3.org/TR/DOM-Level-3-Core/">DOM Level 3 Core</a> API supported in a web browser. The following objects and properties are supported by the QML implementation:</p>
<table class="generic">
<thead><tr class="qt-style"><th ><b>Node</b></th><th ><b>Document</b></th><th ><b>Element</b></th><th ><b>Attr</b></th><th ><b>CharacterData</b></th><th ><b>Text</b></th></tr></thead>
<tr valign="top" class="odd"><td ><ul>
<li>nodeName</li>
<li>nodeValue</li>
<li>nodeType</li>
<li>parentNode</li>
<li>childNodes</li>
<li>firstChild</li>
<li>lastChild</li>
<li>previousSibling</li>
<li>nextSibling</li>
<li>attributes</li>
</ul>
</td><td ><ul>
<li>xmlVersion</li>
<li>xmlEncoding</li>
<li>xmlStandalone</li>
<li>documentElement</li>
</ul>
</td><td ><ul>
<li>tagName</li>
</ul>
</td><td ><ul>
<li>name</li>
<li>value</li>
<li>ownerElement</li>
</ul>
</td><td ><ul>
<li>data</li>
<li>length</li>
</ul>
</td><td ><ul>
<li>isElementContentWhitespace</li>
<li>wholeText</li>
</ul>
</td></tr>
</table>
<p>The <a href="declarative-xml-xmlhttprequest.html">XMLHttpRequest example</a> demonstrates how to use the <a href="#xmlhttprequest">XMLHttpRequest</a> object to make a request and read the response headers.</p>
<a name="offline-storage-api"></a>
<h2>Offline Storage API</h2>
<a name="database-api"></a>
<h3>Database API</h3>
<p>The <tt>openDatabaseSync()</tt> and related functions provide the ability to access local offline storage in an SQL database.</p>
<p>These databases are user-specific and QML-specific, but accessible to all QML applications. They are stored in the <tt>Databases</tt> subdirectory of <a href="qdeclarativeengine.html#offlineStoragePath-prop">QDeclarativeEngine::offlineStoragePath</a>(), currently as SQLite databases.</p>
<p>The API can be used from JavaScript functions in your QML:</p>
<pre class="qml"></pre>
<p>The API conforms to the Synchronous API of the HTML5 Web Database API, <a href="http://www.w3.org/TR/2009/WD-webdatabase-20091029/">W3C Working Draft 29 October 2009</a>.</p>
<p>The <a href="declarative-sqllocalstorage.html">SQL Local Storage example</a> demonstrates the basics of using the Offline Storage API.</p>
<a name="db-opendatabasesync-identifier-version-description-estimated-size-callback-db"></a>
<h4>db = openDatabaseSync(identifier, version, description, estimated_size, callback(db))</h4>
<p>Returns the database identified by <i>identifier</i>. If the database does not already exist, it is created, and the function <i>callback</i> is called with the database as a parameter. <i>description</i> and <i>estimated_size</i> are written to the INI file (described below), but are otherwise currently unused.</p>
<p>May throw exception with code property SQLException.DATABASE_ERR, or SQLException.VERSION_ERR.</p>
<p>When a database is first created, an INI file is also created specifying its characteristics:</p>
<table class="generic">
<thead><tr class="qt-style"><th ><b>Key</b></th><th ><b>Value</b></th></tr></thead>
<tr valign="top" class="odd"><td >Name</td><td >The name of the database passed to <tt>openDatabase()</tt></td></tr>
<tr valign="top" class="even"><td >Version</td><td >The version of the database passed to <tt>openDatabase()</tt></td></tr>
<tr valign="top" class="odd"><td >Description</td><td >The description of the database passed to <tt>openDatabase()</tt></td></tr>
<tr valign="top" class="even"><td >EstimatedSize</td><td >The estimated size (in bytes) of the database passed to <tt>openDatabase()</tt></td></tr>
<tr valign="top" class="odd"><td >Driver</td><td >Currently &quot;QSQLITE&quot;</td></tr>
</table>
<p>This data can be used by application tools.</p>
<a name="db-changeversion-from-to-callback-tx"></a>
<h4>db.changeVersion(from, to, callback(tx))</h4>
<p>This method allows you to perform a <i>Scheme Upgrade</i>.</p>
<p>If the current version of <i>db</i> is not <i>from</i>, then an exception is thrown.</p>
<p>Otherwise, a database transaction is created and passed to <i>callback</i>. In this function, you can call <i>executeSql</i> on <i>tx</i> to upgrade the database.</p>
<p>May throw exception with code property SQLException.DATABASE_ERR or SQLException.UNKNOWN_ERR.</p>
<a name="db-transaction-callback-tx"></a>
<h4>db.transaction(callback(tx))</h4>
<p>This method creates a read/write transaction and passed to <i>callback</i>. In this function, you can call <i>executeSql</i> on <i>tx</i> to read and modify the database.</p>
<p>If the callback throws exceptions, the transaction is rolled back.</p>
<a name="db-readtransaction-callback-tx"></a>
<h4>db.readTransaction(callback(tx))</h4>
<p>This method creates a read-only transaction and passed to <i>callback</i>. In this function, you can call <i>executeSql</i> on <i>tx</i> to read the database (with SELECT statements).</p>
<a name="results-tx-executesql-statement-values"></a>
<h4>results = tx.executeSql(statement, values)</h4>
<p>This method executes a SQL <i>statement</i>, binding the list of <i>values</i> to SQL positional parameters (&quot;?&quot;).</p>
<p>It returns a results object, with the following properties:</p>
<table class="generic">
<thead><tr class="qt-style"><th ><b>Type</b></th><th ><b>Property</b></th><th ><b>Value</b></th><th ><b>Applicability</b></th></tr></thead>
<tr valign="top" class="odd"><td >int</td><td >rows.length</td><td >The number of rows in the result</td><td >SELECT</td></tr>
<tr valign="top" class="even"><td >var</td><td >rows.item(i)</td><td >Function that returns row <i>i</i> of the result</td><td >SELECT</td></tr>
<tr valign="top" class="odd"><td >int</td><td >rowsAffected</td><td >The number of rows affected by a modification</td><td >UPDATE, DELETE</td></tr>
<tr valign="top" class="even"><td >string</td><td >insertId</td><td >The id of the row inserted</td><td >INSERT</td></tr>
</table>
<p>May throw exception with code property SQLException.DATABASE_ERR, SQLException.SYNTAX_ERR, or SQLException.UNKNOWN_ERR.</p>
<a name="logging"></a>
<h2>Logging</h2>
<p><tt>console.log()</tt> and <tt>console.debug()</tt> can be used to print information to the console. See <a href="qdeclarativedebugging.html">Debugging QML</a> for more information.</p>
</div>
<!-- @@@qdeclarativeglobalobject.html -->
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      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>
      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. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>