Sophie

Sophie

distrib > Mageia > 6 > i586 > by-pkgid > 2cba8df17162abb32fcb8e6852f3eacc > files > 712

qtdeclarative5-doc-5.9.4-1.mga6.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" />
<!-- qquickborderimage.cpp -->
  <title>BorderImage QML Type | Qt Quick 5.9</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.9</td><td ><a href="qtquick-index.html">Qt Quick</a></td><td ><a href="qtquick-qmlmodule.html">QML Types</a></td><td >BorderImage QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</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="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#example-usage">Example Usage</a></li>
<li class="level2"><a href="#image-loading">Image Loading</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">BorderImage QML Type</h1>
<span class="subtitle"></span>
<!-- $$$BorderImage-brief -->
<p>Paints a border based on an image <a href="#details">More...</a></p>
<!-- @@@BorderImage -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick 2.7</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-item.html">Item</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-borderimage-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#asynchronous-prop">asynchronous</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#border-prop">border</a></b></b><ul>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#border.left-prop">border.left</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#border.right-prop">border.right</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#border.top-prop">border.top</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#border.bottom-prop">border.bottom</a></b></b> : int</li>
</ul>
</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#cache-prop">cache</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#horizontalTileMode-prop">horizontalTileMode</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#mirror-prop">mirror</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#progress-prop">progress</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#smooth-prop">smooth</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#source-prop">source</a></b></b> : url</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#sourceSize-prop">sourceSize</a></b></b> : QSize</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#status-prop">status</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-borderimage.html#verticalTileMode-prop">verticalTileMode</a></b></b> : enumeration</li>
</ul>
<!-- $$$BorderImage-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p>The <a href="qtquick-imageelements-example.html#borderimage">BorderImage</a> type is used to create borders out of images by scaling or tiling parts of each image.</p>
<p>A <a href="qtquick-imageelements-example.html#borderimage">BorderImage</a> breaks a source image, specified using the <a href="qml-qtquick-borderimage.html#source-prop">source</a> property, into 9 regions, as shown below:</p>
<p class="centerAlign"><img src="images/declarative-scalegrid.png" alt="" /></p><p>When the image is scaled, regions of the source image are scaled or tiled to create the displayed border image in the following way:</p>
<ul>
<li>The corners (regions 1, 3, 7, and 9) are not scaled at all.</li>
<li>Regions 2 and 8 are scaled according to <a href="qml-qtquick-borderimage.html#horizontalTileMode-prop">horizontalTileMode</a>.</li>
<li>Regions 4 and 6 are scaled according to <a href="qml-qtquick-borderimage.html#verticalTileMode-prop">verticalTileMode</a>.</li>
<li>The middle (region 5) is scaled according to both <a href="qml-qtquick-borderimage.html#horizontalTileMode-prop">horizontalTileMode</a> and <a href="qml-qtquick-borderimage.html#verticalTileMode-prop">verticalTileMode</a>.</li>
</ul>
<p>The regions of the image are defined using the <a href="qml-qtquick-borderimage.html#border-prop">border</a> property group, which describes the distance from each edge of the source image to use as a border.</p>
<a name="example-usage"></a>
<h2 id="example-usage">Example Usage</h2>
<p>The following examples show the effects of the different modes on an image. Guide lines are overlaid onto the image to show the different regions of the image as described above.</p>
<div style="float: left; margin-right: 2em"><p class="centerAlign"><img src="images/qml-borderimage-normal-image.png" alt="" /></p></div><p>An unscaled image is displayed using an Image. The <a href="qml-qtquick-borderimage.html#border-prop">border</a> property is used to determine the parts of the image that will lie inside the unscaled corner areas and the parts that will be stretched horizontally and vertically.</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-image.html">Image</a></span> {
      <span class="name">source</span>: <span class="string">&quot;pics/borderframe.png&quot;</span>
  }

</pre>
<br style="clear: both" /><div style="float: left; margin-right: 2em"><p class="centerAlign"><img src="images/qml-borderimage-scaled.png" alt="" /></p></div><p>A <a href="qtquick-imageelements-example.html#borderimage">BorderImage</a> is used to display the image, and it is given a size that is larger than the original image. Since the <a href="qml-qtquick-borderimage.html#horizontalTileMode-prop">horizontalTileMode</a> property is set to <a href="qml-qtquick-borderimage.html#horizontalTileMode-prop">BorderImage.Stretch</a>, the parts of image in regions 2 and 8 are stretched horizontally. Since the <a href="qml-qtquick-borderimage.html#verticalTileMode-prop">verticalTileMode</a> property is set to <a href="qml-qtquick-borderimage.html#verticalTileMode-prop">BorderImage.Stretch</a>, the parts of image in regions 4 and 6 are stretched vertically.</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-borderimage.html">BorderImage</a></span> {
      <span class="name">width</span>: <span class="number">180</span>; <span class="name">height</span>: <span class="number">180</span>
      <span class="type">border</span> { <span class="name">left</span>: <span class="number">30</span>; <span class="name">top</span>: <span class="number">30</span>; <span class="name">right</span>: <span class="number">30</span>; <span class="name">bottom</span>: <span class="number">30</span> }
      <span class="name">horizontalTileMode</span>: <span class="name">BorderImage</span>.<span class="name">Stretch</span>
      <span class="name">verticalTileMode</span>: <span class="name">BorderImage</span>.<span class="name">Stretch</span>
      <span class="name">source</span>: <span class="string">&quot;pics/borderframe.png&quot;</span>
  }

</pre>
<br style="clear: both" /><div style="float: left; margin-right: 2em"><p class="centerAlign"><img src="images/qml-borderimage-tiled.png" alt="" /></p></div><p>Again, a large <a href="qtquick-imageelements-example.html#borderimage">BorderImage</a> is used to display the image. With the <a href="qml-qtquick-borderimage.html#horizontalTileMode-prop">horizontalTileMode</a> property set to <a href="qml-qtquick-borderimage.html#horizontalTileMode-prop">BorderImage.Repeat</a>, the parts of image in regions 2 and 8 are tiled so that they fill the space at the top and bottom of the item. Similarly, the <a href="qml-qtquick-borderimage.html#verticalTileMode-prop">verticalTileMode</a> property is set to <a href="qml-qtquick-borderimage.html#verticalTileMode-prop">BorderImage.Repeat</a>, the parts of image in regions 4 and 6 are tiled so that they fill the space at the left and right of the item.</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-borderimage.html">BorderImage</a></span> {
      <span class="name">width</span>: <span class="number">180</span>; <span class="name">height</span>: <span class="number">180</span>
      <span class="type">border</span> { <span class="name">left</span>: <span class="number">30</span>; <span class="name">top</span>: <span class="number">30</span>; <span class="name">right</span>: <span class="number">30</span>; <span class="name">bottom</span>: <span class="number">30</span> }
      <span class="name">horizontalTileMode</span>: <span class="name">BorderImage</span>.<span class="name">Repeat</span>
      <span class="name">verticalTileMode</span>: <span class="name">BorderImage</span>.<span class="name">Repeat</span>
      <span class="name">source</span>: <span class="string">&quot;pics/borderframe.png&quot;</span>
  }

</pre>
<br style="clear: both" /><p>In some situations, the width of regions 2 and 8 may not be an exact multiple of the width of the corresponding regions in the source image. Similarly, the height of regions 4 and 6 may not be an exact multiple of the height of the corresponding regions. It can be useful to use <a href="qml-qtquick-borderimage.html#horizontalTileMode-prop">BorderImage.Round</a> instead of <a href="qml-qtquick-borderimage.html#horizontalTileMode-prop">BorderImage.Repeat</a> in cases like these.</p>
<p>The Border Image example in <a href="qtquick-imageelements-example.html">Qt Quick Examples - Image Elements</a> shows how a <a href="qtquick-imageelements-example.html#borderimage">BorderImage</a> can be used to simulate a shadow effect on a rectangular item.</p>
<a name="image-loading"></a>
<h2 id="image-loading">Image Loading</h2>
<p>The source image may not be loaded instantaneously, depending on its original location. Loading progress can be monitored with the <a href="qml-qtquick-borderimage.html#progress-prop">progress</a> property.</p>
<p><b>See also </b><a href="qtquick-imageelements-example.html#image">Image</a> and <a href="qml-qtquick-animatedimage.html">AnimatedImage</a>.</p>
<!-- @@@BorderImage -->
<h2>Property Documentation</h2>
<!-- $$$asynchronous -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="asynchronous-prop">
<td class="tblQmlPropNode"><p>
<a name="asynchronous-prop"></a><span class="name">asynchronous</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Specifies that images on the local filesystem should be loaded asynchronously in a separate thread. The default value is false, causing the user interface thread to block while the image is loaded. Setting <i>asynchronous</i> to true is useful where maintaining a responsive user interface is more desirable than having images immediately visible.</p>
<p>Note that this property is only valid for images read from the local filesystem. Images loaded via a network resource (e.g&#x2e; HTTP) are always loaded asynchronously.</p>
</div></div><!-- @@@asynchronous -->
<br/>
<!-- $$$border -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="even" id="border-prop"><th class="centerAlign"><p><a name="border-prop"></a><b>border group</b></p></th></tr><tr valign="top" class="odd" id="border.left-prop"><td class="tblQmlPropNode"><p><a name="border.left-prop"></a><span class="name">border.left</span> : <span class="type">int</span></p></td></tr><tr valign="top" class="odd" id="border.right-prop"><td class="tblQmlPropNode"><p><a name="border.right-prop"></a><span class="name">border.right</span> : <span class="type">int</span></p></td></tr><tr valign="top" class="odd" id="border.top-prop"><td class="tblQmlPropNode"><p><a name="border.top-prop"></a><span class="name">border.top</span> : <span class="type">int</span></p></td></tr><tr valign="top" class="odd" id="border.bottom-prop"><td class="tblQmlPropNode"><p><a name="border.bottom-prop"></a><span class="name">border.bottom</span> : <span class="type">int</span></p></td></tr></table></div></div><div class="qmldoc"><p>The 4 border lines (2 horizontal and 2 vertical) break the image into 9 sections, as shown below:</p>
<p class="centerAlign"><img src="images/declarative-scalegrid.png" alt="" /></p><p>Each border line (left, right, top, and bottom) specifies an offset in pixels from the respective edge of the source image. By default, each border line has a value of 0.</p>
<p>For example, the following definition sets the bottom line 10 pixels up from the bottom of the image:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-borderimage.html">BorderImage</a></span> {
      <span class="name">border</span>.bottom: <span class="number">10</span>
      <span class="comment">// ...</span>
  }

</pre>
<p>The border lines can also be specified using a <a href="qml-qtquick-borderimage.html#source-prop">.sci file</a>.</p>
</div></div><!-- @@@border -->
<br/>
<!-- $$$cache -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="cache-prop">
<td class="tblQmlPropNode"><p>
<a name="cache-prop"></a><span class="name">cache</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Specifies whether the image should be cached. The default value is true. Setting <i>cache</i> to false is useful when dealing with large images, to make sure that they aren't cached at the expense of small 'ui element' images.</p>
</div></div><!-- @@@cache -->
<br/>
<!-- $$$horizontalTileMode -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="horizontalTileMode-prop">
<td class="tblQmlPropNode"><p>
<a name="horizontalTileMode-prop"></a><span class="name">horizontalTileMode</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property describes how to repeat or stretch the middle parts of the border image.</p>
<ul>
<li><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Stretch - Scales the image to fit to the available area.</li>
<li><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Repeat - Tile the image until there is no more space. May crop the last image.</li>
<li><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Round - Like Repeat, but scales the images down to ensure that the last image is not cropped.</li>
</ul>
<p>The default tile mode for each property is <a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Stretch.</p>
</div></div><!-- @@@horizontalTileMode -->
<br/>
<!-- $$$mirror -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="mirror-prop">
<td class="tblQmlPropNode"><p>
<a name="mirror-prop"></a><span class="name">mirror</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds whether the image should be horizontally inverted (effectively displaying a mirrored image).</p>
<p>The default value is false.</p>
</div></div><!-- @@@mirror -->
<br/>
<!-- $$$progress -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="progress-prop">
<td class="tblQmlPropNode"><p>
<a name="progress-prop"></a><span class="name">progress</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the progress of image loading, from 0.0 (nothing loaded) to 1.0 (finished).</p>
<p><b>See also </b><a href="qml-qtquick-borderimage.html#status-prop">status</a>.</p>
</div></div><!-- @@@progress -->
<br/>
<!-- $$$smooth -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="smooth-prop">
<td class="tblQmlPropNode"><p>
<a name="smooth-prop"></a><span class="name">smooth</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds whether the image is smoothly filtered when scaled or transformed. Smooth filtering gives better visual quality, but it may be slower on some hardware. If the image is displayed at its natural size, this property has no visual or performance effect.</p>
<p>By default, this property is set to true.</p>
</div></div><!-- @@@smooth -->
<br/>
<!-- $$$source -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="source-prop">
<td class="tblQmlPropNode"><p>
<a name="source-prop"></a><span class="name">source</span> : <span class="type">url</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the URL that refers to the source image.</p>
<p><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a> can handle any image format supported by Qt, loaded from any URL scheme supported by Qt.</p>
<p>This property can also be used to refer to .sci files, which are written in a QML-specific, text-based format that specifies the borders, the image file and the tile rules for a given border image.</p>
<p>The following .sci file sets the borders to 10 on each side for the image <code>picture.png</code>:</p>
<pre class="cpp">

  border<span class="operator">.</span>left: <span class="number">10</span>
  border<span class="operator">.</span>top: <span class="number">10</span>
  border<span class="operator">.</span>bottom: <span class="number">10</span>
  border<span class="operator">.</span>right: <span class="number">10</span>
  source: <span class="string">&quot;picture.png&quot;</span>

</pre>
<p>The URL may be absolute, or relative to the URL of the component.</p>
<p><b>See also </b><a href="qquickimageprovider.html">QQuickImageProvider</a>.</p>
</div></div><!-- @@@source -->
<br/>
<!-- $$$sourceSize -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="sourceSize-prop">
<td class="tblQmlPropNode"><p>
<a name="sourceSize-prop"></a><span class="name">sourceSize</span> : <span class="type">QSize</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the actual width and height of the loaded image.</p>
<p>In <a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>, this property is read-only.</p>
<p><b>See also </b><a href="qml-qtquick-image.html#sourceSize-prop">Image::sourceSize</a>.</p>
</div></div><!-- @@@sourceSize -->
<br/>
<!-- $$$status -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="status-prop">
<td class="tblQmlPropNode"><p>
<a name="status-prop"></a><span class="name">status</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property describes the status of image loading. It can be one of:</p>
<ul>
<li><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Null - no image has been set</li>
<li><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Ready - the image has been loaded</li>
<li><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Loading - the image is currently being loaded</li>
<li><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Error - an error occurred while loading the image</li>
</ul>
<p><b>See also </b><a href="qml-qtquick-borderimage.html#progress-prop">progress</a>.</p>
</div></div><!-- @@@status -->
<br/>
<!-- $$$verticalTileMode -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="verticalTileMode-prop">
<td class="tblQmlPropNode"><p>
<a name="verticalTileMode-prop"></a><span class="name">verticalTileMode</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property describes how to repeat or stretch the middle parts of the border image.</p>
<ul>
<li><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Stretch - Scales the image to fit to the available area.</li>
<li><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Repeat - Tile the image until there is no more space. May crop the last image.</li>
<li><a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Round - Like Repeat, but scales the images down to ensure that the last image is not cropped.</li>
</ul>
<p>The default tile mode for each property is <a href="qtquick-imageelements-example.html#borderimage">BorderImage</a>.Stretch.</p>
</div></div><!-- @@@verticalTileMode -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 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>