<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- positioners.qdoc --> <title>Qt Quick Examples - Positioners | 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 - Positioners</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="#transitions">Transitions</a></li> <li class="level1"><a href="#attached-properties">Attached Properties</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">Qt Quick Examples - Positioners</h1> <span class="subtitle"></span> <!-- $$$positioners-brief --> <p>This is a collection of QML Positioner examples.</p> <!-- @@@positioners --> <!-- $$$positioners-description --> <div class="descr"> <a name="details"></a> <p class="centerAlign"><img src="images/qml-positioners-example.png" alt="" /></p><p><i>Positioners</i> is a collection of small QML examples relating to positioners. Each example is a small QML file emphasizing a particular type or feature. For more information, visit <a href="qtquick-positioning-topic.html">Important Concepts In Qt Quick - Positioning</a>.</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="transitions"></a> <h2 id="transitions">Transitions</h2> <p><i>Transitions</i> shows animated transitions when showing or hiding items in a positioner. It consists of a scene populated with items in a variety of positioners: <a href="qml-qtquick-column.html">Column</a>, <a href="qml-qtquick-row.html">Row</a>, <a href="qml-qtquick-grid.html">Grid</a>, and <a href="qml-qtquick-flow.html">Flow</a>. Each positioner has animations described as Transitions.</p> <pre class="qml"> move: Transition { NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } } </pre> <p>The move transition specifies how items inside a positioner will animate when they are displaced by the appearance or disappearance of other items.</p> <pre class="qml"> add: Transition { NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } } </pre> <p>The add transition specifies how items will appear when they are added to a positioner.</p> <pre class="qml"> populate: Transition { NumberAnimation { properties: "x,y"; from: 200; duration: 100; easing.type: Easing.OutBounce } } </pre> <p>The populate transition specifies how items will appear when their parent positioner is first created.</p> <a name="attached-properties"></a> <h2 id="attached-properties">Attached Properties</h2> <p><i>Attached Properties</i> shows how the Positioner attached property can be used to determine where an item is within a positioner.</p> <pre class="qml"> Rectangle { id: green color: "#80c342" width: 100 * page.ratio height: 100 * page.ratio Text { anchors.left: parent.right anchors.leftMargin: 20 anchors.verticalCenter: parent.verticalCenter text: "Index: " + parent.Positioner.index + (parent.Positioner.isFirstItem ? " (First)" : "") + (parent.Positioner.isLastItem ? " (Last)" : "") } // When mouse is clicked, display the values of the positioner MouseArea { anchors.fill: parent onClicked: column.showInfo(green.Positioner) } } </pre> <p>Files:</p> <ul> <li><a href="qtquick-positioners-main-cpp.html">positioners/main.cpp</a></li> <li><a href="qtquick-positioners-positioners-attachedproperties-qml.html">positioners/positioners-attachedproperties.qml</a></li> <li><a href="qtquick-positioners-positioners-transitions-qml.html">positioners/positioners-transitions.qml</a></li> <li><a href="qtquick-positioners-positioners-pro.html">positioners/positioners.pro</a></li> <li><a href="qtquick-positioners-positioners-qml.html">positioners/positioners.qml</a></li> <li><a href="qtquick-positioners-positioners-qmlproject.html">positioners/positioners.qmlproject</a></li> <li><a href="qtquick-positioners-positioners-qrc.html">positioners/positioners.qrc</a></li> </ul> </div> <!-- @@@positioners --> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</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>