/usr/share/qt5/doc/qtqml/qml-url.html is in qtdeclarative5-doc-html 5.2.1-3ubuntu15.
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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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" />
<!-- basictypes.qdoc -->
<title>QML Basic Type: url | QtQml 5.2</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>Qt 5.2</li>
<li><a href="qtqml-index.html">Qt QML</a></li>
<li><a href="qtqml-qmlmodule.html">QML Types</a></li>
<li>QML Basic Type: url</li>
<li id="buildversion">
Qt 5.2.1 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#using-the-url-type">Using the url Type</a></li>
</ul>
</div>
<h1 class="title">QML Basic Type: url</h1>
<span class="subtitle"></span>
<!-- $$$url-description -->
<div class="descr"> <a name="details"></a>
<p>The <tt>url</tt> type refers to a resource locator (like a file name, for example). It can be either absolute, e.g. "http://qt-project.org", or relative, e.g. "pics/logo.png". A relative URL is resolved relative to the URL of the containing component.</p>
<p>For example, the following assigns a valid URL to the Image::source property, which is of type <tt>url</tt>:</p>
<pre class="qml"><span class="type">Image</span> { <span class="name">source</span>: <span class="string">"pics/logo.png"</span> }</pre>
<p>When integrating with C++, note that any QUrl value <a href="qtqml-cppintegration-data.html">passed into QML from C++</a> is automatically converted into a <tt>url</tt> value, and vice-versa.</p>
<a name="using-the-url-type"></a>
<h2>Using the url Type</h2>
<p>When a relative URL is written to a <tt>url</tt> type property, it is converted into a URL object, so <b>matching the URL value against the input string value will fail</b>. Instead, convert the string to a URL using Qt.resolvedUrl() for means of comparison, and use <tt>toString()</tt> to get the contents of the URL:</p>
<pre class="qml"><span class="type">Image</span> {
<span class="name">source</span>: <span class="string">"pics/logo.png"</span>
<span class="name">Component</span>.onCompleted: {
<span class="comment">// This prints 'false'. Although "pics/logo.png" was the input string,</span>
<span class="comment">// it's been converted from a string to a URL, so these two are not the same.</span>
<span class="name">console</span>.<span class="name">log</span>(<span class="name">source</span> <span class="operator">==</span> <span class="string">"pics/logo.png"</span>)
<span class="comment">// This prints 'true' as Qt.resovledUrl() converts the string into a</span>
<span class="comment">// URL with the correctly resolved path</span>
<span class="name">console</span>.<span class="name">log</span>(<span class="name">source</span> <span class="operator">==</span> <span class="name">Qt</span>.<span class="name">resolvedUrl</span>(<span class="string">"pics/logo.png"</span>))
<span class="comment">// This prints the absolute path, e.g. "file:///path/to/pics/logo.png"</span>
<span class="name">console</span>.<span class="name">log</span>(<span class="name">source</span>.<span class="name">toString</span>())
}
}</pre>
<p><b>Note: </b>When referring to files stored with the Qt Resource System from within QML, you should use "qrc:///" instead of ":/" as QML requires URL paths. Relative URLs resolved from within that file will use the same protocol.</p><p>Additionally, URLs may contain encoded characters using the 'percent-encoding' scheme specified by <a href="http://tools.ietf.org/html/rfc3986">RFC 3986</a>. These characters will be preserved within properties of type <tt>url</tt>, to allow QML code to construct precise URL values. An exception to this rule is the preemptive decoding of directory-separator characters (<tt>'/'</tt>) - these characters are decoded to allow the URL to be correctly classified.</p>
<p>For example, a local file containing a '#' character, which would normally be interpreted as the beginning of the URL 'fragment' element, can be accessed by encoding the characters of the file name:</p>
<pre class="qml"><span class="type">Image</span> { <span class="name">source</span>: <span class="name">encodeURIComponent</span>(<span class="string">"/tmp/test#1.png"</span>) }</pre>
<p>This basic type is provided by the QML language.</p>
</div>
<p><b>See also </b><a href="qtqml-typesystem-basictypes.html">QML Basic Types</a>.</p>
<!-- @@@url -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
subsidiaries. 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> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|