Sophie

Sophie

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

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" />
<!-- imageelements.qdoc -->
  <title>Qt Quick Examples - Image Elements | 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 Examples - Image Elements</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="level1"><a href="#running-the-example">Running the Example</a></li>
<li class="level1"><a href="#scaling-with-borderimage">Scaling with BorderImage</a></li>
<li class="level1"><a href="#image-fill">Image Fill</a></li>
<li class="level1"><a href="#shadow-effects">Shadow Effects</a></li>
<li class="level1"><a href="#sprite-animations-with-animatedsprite">Sprite Animations with AnimatedSprite</a></li>
<li class="level1"><a href="#sprite-animations-with-spritesequence">Sprite Animations with SpriteSequence</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Qt Quick Examples - Image Elements</h1>
<span class="subtitle"></span>
<!-- $$$imageelements-brief -->
<p>This is a collection of QML examples relating to image types.</p>
<!-- @@@imageelements -->
<!-- $$$imageelements-description -->
<div class="descr"> <a name="details"></a>
<p class="centerAlign"><img src="images/qml-imageelements-example.png" alt="" /></p><p><i>Image Elements</i> is a collection of small QML examples relating to image types. For more information, visit Use Case - Visual Elements In QML.</p>
<a name="running-the-example"></a>
<h2 id="running-the-example">Running the Example</h2>
<p>To run the example from Qt Creator, open the <b>Welcome</b> mode and select the example from <b>Examples</b>. For more information, visit Building and Running an Example.</p>
<a name="scaling-with-borderimage"></a>
<h2 id="scaling-with-borderimage">Scaling with BorderImage</h2>
<p><i>BorderImage</i> shows off the various scaling modes of the <a href="qml-qtquick-borderimage.html">BorderImage</a> type by setting its horizontalTileMode and verticalTileMode properties.</p>
<a name="image-fill"></a>
<h2 id="image-fill">Image Fill</h2>
<p><i>Image</i> shows off the various fill modes of the <a href="qml-qtquick-image.html">Image</a> type.</p>
<a name="shadow-effects"></a>
<h2 id="shadow-effects">Shadow Effects</h2>
<p><i>Shadows</i> shows how to create a drop shadow effect for a rectangular item using a <a href="qml-qtquick-borderimage.html">BorderImage</a>:</p>
<pre class="qml">

      BorderImage {
          anchors.fill: rectangle
          anchors { leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 }
          border { left: 10; top: 10; right: 10; bottom: 10 }
          source: "shadow.png"
      }

</pre>
<a name="sprite-animations-with-animatedsprite"></a>
<h2 id="sprite-animations-with-animatedsprite">Sprite Animations with AnimatedSprite</h2>
<p><i>AnimatedSprite</i> shows how to display a simple animation using an <a href="qml-qtquick-animatedsprite.html">AnimatedSprite</a> object:</p>
<pre class="qml">

      AnimatedSprite {
          id: sprite
          anchors.centerIn: parent
          source: "content/speaker.png"
          frameCount: 60
          frameSync: true
          frameWidth: 170
          frameHeight: 170
          loops: 3
      }

</pre>
<p>The sprite animation will loop three times.</p>
<a name="sprite-animations-with-spritesequence"></a>
<h2 id="sprite-animations-with-spritesequence">Sprite Animations with SpriteSequence</h2>
<p><i>SpriteSequence</i> demonstrates using a sprite sequence to draw an animated and interactive bear. The <a href="qml-qtquick-spritesequence.html">SpriteSequence</a> object defines five different sprites. The bear is initially in a <i>still</i> state:</p>
<pre class="qml">

          Sprite{
              name: "still"
              source: "content/BearSheet.png"
              frameCount: 1
              frameWidth: 256
              frameHeight: 256
              frameDuration: 100
              to: {"still":1, "blink":0.1, "floating":0}
          }

</pre>
<p>When the scene is clicked, an animation sets the sprite sequence to the <i>falling</i> states and animates the bear's y property.</p>
<pre class="qml">

      SequentialAnimation {
          id: anim
          ScriptAction { script: image.goalSprite = "falling"; }
          NumberAnimation { target: image; property: "y"; to: 480; duration: 12000; }
          ScriptAction { script: {image.goalSprite = ""; image.jumpTo("still");} }
          PropertyAction { target: image; property: "y"; value: 0 }
      }

</pre>
<p>At the end of the animation the bear is set back to its initial state.</p>
<p>Files:</p>
<ul>
<li><a href="qtquick-imageelements-animatedimage-qml.html">imageelements/animatedimage.qml</a></li>
<li><a href="qtquick-imageelements-animatedsprite-qml.html">imageelements/animatedsprite.qml</a></li>
<li><a href="qtquick-imageelements-borderimage-qml.html">imageelements/borderimage.qml</a></li>
<li><a href="qtquick-imageelements-content-borderimageselector-qml.html">imageelements/content/BorderImageSelector.qml</a></li>
<li><a href="qtquick-imageelements-content-imagecell-qml.html">imageelements/content/ImageCell.qml</a></li>
<li><a href="qtquick-imageelements-content-myborderimage-qml.html">imageelements/content/MyBorderImage.qml</a></li>
<li><a href="qtquick-imageelements-content-shadowrectangle-qml.html">imageelements/content/ShadowRectangle.qml</a></li>
<li><a href="qtquick-imageelements-image-qml.html">imageelements/image.qml</a></li>
<li><a href="qtquick-imageelements-imageelements-pro.html">imageelements/imageelements.pro</a></li>
<li><a href="qtquick-imageelements-imageelements-qml.html">imageelements/imageelements.qml</a></li>
<li><a href="qtquick-imageelements-imageelements-qmlproject.html">imageelements/imageelements.qmlproject</a></li>
<li><a href="qtquick-imageelements-imageelements-qrc.html">imageelements/imageelements.qrc</a></li>
<li><a href="qtquick-imageelements-main-cpp.html">imageelements/main.cpp</a></li>
<li><a href="qtquick-imageelements-shadows-qml.html">imageelements/shadows.qml</a></li>
<li><a href="qtquick-imageelements-spritesequence-qml.html">imageelements/spritesequence.qml</a></li>
</ul>
<p>Images:</p>
<ul>
<li><a href="images/used-in-examples/imageelements/content/BearSheet.png">imageelements/content/BearSheet.png</a></li>
<li><a href="images/used-in-examples/imageelements/content/Uniflow_steam_engine.gif">imageelements/content/Uniflow_steam_engine.gif</a></li>
<li><a href="images/used-in-examples/imageelements/content/arrow.png">imageelements/content/arrow.png</a></li>
<li><a href="images/used-in-examples/imageelements/content/bw.png">imageelements/content/bw.png</a></li>
<li><a href="images/used-in-examples/imageelements/content/colors.png">imageelements/content/colors.png</a></li>
<li><a href="images/used-in-examples/imageelements/content/qt-logo.png">imageelements/content/qt-logo.png</a></li>
<li><a href="images/used-in-examples/imageelements/content/shadow.png">imageelements/content/shadow.png</a></li>
<li><a href="images/used-in-examples/imageelements/content/speaker.png">imageelements/content/speaker.png</a></li>
</ul>
</div>
<!-- @@@imageelements -->
        </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>