This file is indexed.

/usr/share/qt5/doc/qtdoc/qtquick-deployment.html is in qt5-doc-html 5.5.1-1.

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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- deployment.qdoc -->
  <title>Deploying QML Applications | Qt 5.5 </title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
    <div class="main">
    <div class="main-rounded">
        <div class="navigationbar">
        <ul>
<li><a href="index.html">Qt 5.5</a></li>
<li>Deploying QML Applications</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
    </ul>
    </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="#deploying-applications-with-qt-creator">Deploying Applications with Qt Creator</a></li>
<li class="level1"><a href="#prototyping-with-qml-scene">Prototyping with QML Scene</a></li>
<li class="level1"><a href="#initializing-the-qml-runtime-in-applications">Initializing the QML Runtime in Applications</a></li>
<li class="level2"><a href="#initializing-with-qquickview">Initializing with QQuickView</a></li>
<li class="level2"><a href="#creating-a-qqmlengine-directly">Creating a QQmlEngine directly</a></li>
<li class="level1"><a href="#managing-resource-files-with-the-qt-resource-system">Managing Resource Files with the Qt Resource System</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Deploying QML Applications</h1>
<span class="subtitle"></span>
<!-- $$$qtquick-deployment.html-description -->
<div class="descr"> <a name="details"></a>
<p>QML documents are loaded and executed by the QML runtime. This includes the Declarative UI engine along with the built-in QML types and plugin modules, and it also provides access to third-party QML types and modules.</p>
<p>Applications that use QML need to invoke the QML runtime in order to execute QML documents. This can be done by creating a <a href="../qtquick/qquickview.html">QQuickView</a> or a <a href="../qtqml/qqmlengine.html">QQmlEngine</a>, as described below. In addition, the Declarative UI package includes the qmlscene tool, which loads <code>.qml</code> files. This tool is useful for developing and testing QML code without the need to write a C++ application to load the QML runtime.</p>
<a name="deploying-applications-with-qt-creator"></a>
<h2 id="deploying-applications-with-qt-creator">Deploying Applications with Qt Creator</h2>
<p><a href="http://doc.qt.io/qtcreator/index.html">Qt Creator</a> deploys and packages QML applications to various platforms. For mobile devices, Qt Creator can directly bundle applications to the respective platform package formats such as APK and BAR.</p>
<p>For more information, visit:</p>
<ul>
<li><a href="deployment.html">Deploying Qt Applications</a></li>
<li><a href="http://doc.qt.io/qtcreator/creator-running-targets.html">Running on Multiple Platforms</a></li>
<li><a href="http://doc.qt.io/qtcreator/creator-deployment.html">Deploying to Mobile Devices</a></li>
</ul>
<p>When running applications on the target platform, the application needs to access the location of the QML libraries. When using <a href="../qmake/qmake-manual.html">qmake</a>, the <code>QT_INSTALL_QML</code> environment points to the location of the libraries. The <a href="http://qt.io/download">Qt Installers</a> install the QML libraries in <i>&lt;version&gt;</i><code>/</code><i>&lt;compiler&gt;</i><code>/qml</code> directory.</p>
<a name="prototyping-with-qml-scene"></a>
<h2 id="prototyping-with-qml-scene">Prototyping with QML Scene</h2>
<p>The Declarative UI package includes a QML runtime tool, <a href="qtquick-qmlscene.html">qmlscene</a>, which loads and displays QML documents. This is useful during the application development phase for prototyping QML-based applications without writing your own C++ applications to invoke the QML runtime.</p>
<a name="initializing-the-qml-runtime-in-applications"></a>
<h2 id="initializing-the-qml-runtime-in-applications">Initializing the QML Runtime in Applications</h2>
<p>To run an application that uses QML, the QML runtime must be invoked by the application. This is done by writing a Qt C++ application that loads the <a href="../qtqml/qqmlengine.html">QQmlEngine</a> by either:</p>
<ul>
<li>Loading the QML file through a <a href="../qtquick/qquickview.html">QQuickView</a> instance, or</li>
<li>Creating a <a href="../qtqml/qqmlengine.html">QQmlEngine</a> instance and loading QML files with <a href="../qtqml/qqmlcomponent.html">QQmlComponent</a></li>
</ul>
<a name="initializing-with-qquickview"></a>
<h3 >Initializing with QQuickView</h3>
<p><a href="../qtquick/qquickview.html">QQuickView</a> is a <a href="../qtgui/qwindow.html">QWindow</a>-based class that is able to load QML files. For example, if there is a QML file, <code>application.qml</code>, it will look like this:</p>
<pre class="qml">import QtQuick 2.3

<span class="type"><a href="../qtquick/qml-qtquick-rectangle.html">Rectangle</a></span> { <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>; <span class="name">color</span>: <span class="string">&quot;red&quot;</span> }</pre>
<p>It can be loaded in a Qt application's <code>main.cpp</code> file like this:</p>
<pre class="cpp"><span class="preprocessor">#include &lt;QGuiApplication&gt;</span>
<span class="preprocessor">#include &lt;QQuickView&gt;</span>

<span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
{
    <span class="type"><a href="../qtgui/qguiapplication.html">QGuiApplication</a></span> app(argc<span class="operator">,</span> argv);

    <span class="type"><a href="../qtquick/qquickview.html">QQuickView</a></span> view;
    view<span class="operator">.</span>setSource(<span class="type"><a href="../qtcore/qurl.html">QUrl</a></span><span class="operator">::</span>fromLocalFile(<span class="string">&quot;application.qml&quot;</span>));
    view<span class="operator">.</span>show();

    <span class="keyword">return</span> app<span class="operator">.</span>exec();
}</pre>
<p>This creates a <a href="../qtgui/qwindow.html">QWindow</a>-based view that displays the contents of <code>application.qml</code>.</p>
<p>The application's <code>.pro</code> <a href="../qmake/qmake-project-files.html">project file</a> must specify the <code>declarative</code> module for the <code>QT</code> variable. For example:</p>
<pre class="cpp">TEMPLATE <span class="operator">+</span><span class="operator">=</span> app
QT <span class="operator">+</span><span class="operator">=</span> quick
SOURCES <span class="operator">+</span><span class="operator">=</span> main<span class="operator">.</span>cpp</pre>
<a name="creating-a-qqmlengine-directly"></a>
<h3 >Creating a QQmlEngine directly</h3>
<p>If <code>application.qml</code> does not have any graphical components, or if it is preferred to avoid <a href="../qtquick/qquickview.html">QQuickView</a> for other reasons, the <a href="../qtqml/qqmlengine.html">QQmlEngine</a> can be constructed directly instead. In this case, <code>application.qml</code> is loaded as a <a href="../qtqml/qqmlcomponent.html">QQmlComponent</a> instance rather than placed into a view:</p>
<pre class="cpp"><span class="preprocessor">#include &lt;QGuiApplication&gt;</span>
<span class="preprocessor">#include &lt;QQmlEngine&gt;</span>
<span class="preprocessor">#include &lt;QQmlContext&gt;</span>
<span class="preprocessor">#include &lt;QQmlComponent&gt;</span>

<span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
{
    <span class="type"><a href="../qtgui/qguiapplication.html">QGuiApplication</a></span> app(argc<span class="operator">,</span> argv);

    <span class="type"><a href="../qtqml/qqmlengine.html">QQmlEngine</a></span> engine;
    <span class="type"><a href="../qtqml/qqmlcontext.html">QQmlContext</a></span> <span class="operator">*</span>objectContext <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="../qtqml/qqmlcontext.html">QQmlContext</a></span>(engine<span class="operator">.</span>rootContext());

    <span class="type"><a href="../qtqml/qqmlcomponent.html">QQmlComponent</a></span> component(<span class="operator">&amp;</span>engine<span class="operator">,</span> <span class="string">&quot;application.qml&quot;</span>);
    <span class="type"><a href="../qtcore/qobject.html">QObject</a></span> <span class="operator">*</span>object <span class="operator">=</span> component<span class="operator">.</span>create(objectContext);

    <span class="comment">// ... delete object and objectContext when necessary</span>

    <span class="keyword">return</span> app<span class="operator">.</span>exec();
}</pre>
<p><a href="../qtgui/qguiapplication.html">QGuiApplication</a> can be replaced by a <a href="../qtcore/qcoreapplication.html">QCoreApplication</a> in the code above in case you are not using any graphical items from Qt Quick. This allows using QML as a language without any dependencies to the <a href="../qtgui/qtgui-index.html">Qt GUI</a> module.</p>
<p>See <a href="../qtqml/qtqml-cppintegration-data.html">qtqml-cppintegration-exposecppattributes.html</a>{Exposing Attributes of C++ Types to QML} for more information about using <a href="../qtqml/qqmlengine.html">QQmlEngine</a>, <a href="../qtqml/qqmlcontext.html">QQmlContext</a> and <a href="../qtqml/qqmlcomponent.html">QQmlComponent</a>, as well as details on including QML files through <a href="../qtcore/resources.html">Qt's Resource system</a>.</p>
<a name="managing-resource-files-with-the-qt-resource-system"></a>
<h2 id="managing-resource-files-with-the-qt-resource-system">Managing Resource Files with the Qt Resource System</h2>
<p>The <a href="../qtcore/resources.html">Qt resource system</a> allows resource files to be stored as binary files in an application executable. This can be useful when building a mixed QML/C++ application as it enables QML files (as well as other resources such as images and sound files) to be referred to through the resource system URI scheme rather than relative or absolute paths to filesystem resources. Note, however, that if you use the resource system, the application executable must be re-compiled whenever a QML source file is changed in order to update the resources in the package.</p>
<p>To use the resource system in a mixed QML/C++ application:</p>
<ul>
<li>Create a <code>.qrc</code> <a href="../qtcore/resources.html">resource collection file</a> that lists resource files in XML format</li>
<li>From C++, load the main QML file as a resource using the <code>:/</code> prefix or as a URL with the <code>qrc</code> scheme</li>
</ul>
<p>Once this is done, all files specified by relative paths in QML will be loaded from the resource system instead. Use of the resource system is completely transparent to the QML layer; this means all QML code should refer to resource files using relative paths and should <i>not</i> use the <code>qrc</code> scheme. This scheme should only be used from C++ code for referring to resource files.</p>
<p>Here is a application packaged using the <a href="../qtcore/resources.html">Qt resource system</a>. The directory structure looks like this:</p>
<pre class="cpp">project
    <span class="operator">|</span><span class="operator">-</span> example<span class="operator">.</span>qrc
    <span class="operator">|</span><span class="operator">-</span> main<span class="operator">.</span>qml
    <span class="operator">|</span><span class="operator">-</span> images
        <span class="operator">|</span><span class="operator">-</span> background<span class="operator">.</span>png
    <span class="operator">|</span><span class="operator">-</span> main<span class="operator">.</span>cpp
    <span class="operator">|</span><span class="operator">-</span> project<span class="operator">.</span>pro</pre>
<p>The <code>main.qml</code> and <code>background.png</code> files will be packaged as resource files. This is done in the <code>example.qrc</code> resource collection file:</p>
<pre class="cpp">&lt;!DOCTYPE RCC&gt;
&lt;RCC version=&quot;1.0&quot;&gt;

&lt;qresource prefix=&quot;/&quot;&gt;
    &lt;file&gt;main.qml&lt;/file&gt;
    &lt;file&gt;images/background.png&lt;/file&gt;
&lt;/qresource&gt;

&lt;/RCC&gt;</pre>
<p>Since <code>background.png</code> is a resource file, <code>main.qml</code> can refer to it using the relative path specified in <code>example.qrc</code>:</p>
<pre class="qml"><span class="comment">// main.qml</span>
import QtQuick 2.3

<span class="type"><a href="../qtquick/qml-qtquick-image.html">Image</a></span> { <span class="name">source</span>: <span class="string">&quot;images/background.png&quot;</span> }</pre>
<p>To allow QML to locate resource files correctly, the <code>main.cpp</code> loads the main QML file, <code>main.qml</code>, as a resource file using the <code>qrc</code> scheme:</p>
<pre class="cpp"><span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>)
{
    <span class="type"><a href="../qtwidgets/qapplication.html">QApplication</a></span> app(argc<span class="operator">,</span> argv);

    <span class="type"><a href="../qtquick/qquickview.html">QQuickView</a></span> view;
    view<span class="operator">.</span>setSource(<span class="type"><a href="../qtcore/qurl.html">QUrl</a></span>(<span class="string">&quot;qrc:/main.qml&quot;</span>));
    view<span class="operator">.</span>show();

    <span class="keyword">return</span> app<span class="operator">.</span>exec();
}</pre>
<p>Finally, <code>project.pro</code> uses the RESOURCES variable to indicate that <code>example.qrc</code> should be used to build the application resources:</p>
<pre class="cpp">QT += qml

SOURCES += main.cpp
RESOURCES += example.qrc</pre>
<p>See <a href="../qtcore/resources.html">The Qt Resource System</a> for more information.</p>
</div>
<!-- @@@qtquick-deployment.html -->
        </div>
       </div>
   </div>
   </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.<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>