Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates > by-pkgid > 6e2327ca1c896c6d674ae53117299f21 > files > 1330

qtdeclarative5-doc-5.12.6-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- plugin.cpp -->
  <title>Qt Quick Shared Image Provider | Qt Quick 5.12.6</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.12</td><td ><a href="qtquick-index.html">Qt Quick</a></td><td >Qt Quick Shared Image Provider</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.6 Reference Documentation</a></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="level2"><a href="#summary">Summary</a></li>
<li class="level2"><a href="#usage">Usage</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Qt Quick Shared Image Provider</h1>
<span class="subtitle"></span>
<!-- $$$Qt.labs.sharedimage-description -->
<div class="descr"> <a name="details"></a>
<a name="summary"></a>
<h3 id="summary">Summary</h3>
<p>This module provides functionality to save memory in use cases where several Qt Quick applications use the same local image files. It does this by placing the decoded QImage data in shared system memory, making it accessible to all the processes (see QSharedMemory).</p>
<p>This module only shares CPU memory. It does not provide sharing of GPU memory or textures.</p>
<a name="usage"></a>
<h3 id="usage">Usage</h3>
<p>To use this module, import it like this:</p>
<pre class="cpp">

  import <span class="type">Qt</span><span class="operator">.</span>labs<span class="operator">.</span>sharedimage <span class="number">1.0</span>

</pre>
<p>The sharing functionality is provided through a <a href="qquickimageprovider.html">QQuickImageProvider</a>. Use the &quot;image:&quot; scheme for the URL source of the image, followed by the identifier <i>shared</i>, followed by the image file path. For example:</p>
<pre class="cpp">

  Image { source: <span class="string">&quot;image://shared/usr/share/wallpapers/mybackground.jpg&quot;</span> }

</pre>
<p>This will look for the file <i>/usr/share/wallpapers/mybackground.jpg</i>. The first process that does this will read the image file using normal Qt image loading. The decoded image data will then be placed in shared memory, using the full file path as key. Later processes requesting the same image will discover that the data is already available in shared memory. They will then use that instead of loading the image file again.</p>
<p>The shared image data will be kept available until the last process has deleted its last reference to the shared image, at which point it is automatically released.</p>
<p>If system memory sharing is not available, the shared image provider falls back to normal, unshared image loading.</p>
<p>The file path must be absolute. To use a relative path, make it absolute using <i>Qt.resolvedUrl()</i> and replace the URL scheme. For example:</p>
<pre class="cpp">

  <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
  property string imagePrefix: <span class="type">Qt</span><span class="operator">.</span>resolvedUrl(<span class="string">&quot;../myimages/&quot;</span>)<span class="operator">.</span>replace(<span class="string">&quot;file://&quot;</span><span class="operator">,</span> <span class="string">&quot;image://shared/&quot;</span>)
  Image { source: imagePrefix <span class="operator">+</span> <span class="string">&quot;myimage.png&quot;</span> }

</pre>
<p>The shared image module does not provide any directly usable QML types.</p>
</div>
<!-- @@@Qt.labs.sharedimage -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 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>