Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-release > by-pkgid > 886c2ed147b4d6954d2d9fb23759f3ff > files > 245

qtquickcontrols25-doc-5.6.2-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" />
<!-- qquickstackview.cpp -->
  <title>StackView QML Type | Qt Labs Controls 5.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    window.onload = function(){document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");};
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.6</td><td ><a href="qtlabscontrols-index.html">Qt Labs Controls</a></td><td ><a href="qt-labs-controls-qmlmodule.html">QML Types</a></td><td >StackView QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.6.2 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="#attached-properties">Attached Properties</a></li>
<li class="level1"><a href="#methods">Methods</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#using-stackview-in-an-application">Using StackView in an Application</a></li>
<li class="level2"><a href="#basic-navigation">Basic Navigation</a></li>
<li class="level2"><a href="#deep-linking">Deep Linking</a></li>
<li class="level2"><a href="#finding-items">Finding Items</a></li>
<li class="level2"><a href="#transitions">Transitions</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">StackView QML Type</h1>
<span class="subtitle"></span>
<!-- $$$StackView-brief -->
<p>Provides a stack-based navigation model. <a href="#details">More...</a></p>
<!-- @@@StackView -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import Qt.labs.controls 1.0</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qt-labs-controls-control.html">Control</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qt-labs-controls-stackview-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-qt-labs-controls-stackview.html#busy-prop">busy</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#currentItem-prop">currentItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#depth-prop">depth</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#initialItem-prop">initialItem</a></b></b> : var</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#popEnter-prop">popEnter</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#popExit-prop">popExit</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#pushEnter-prop">pushEnter</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#pushExit-prop">pushExit</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#replaceEnter-prop">replaceEnter</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#replaceExit-prop">replaceExit</a></b></b> : Transition</li>
</ul>
<a name="attached-properties"></a>
<h2 id="attached-properties">Attached Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#index-attached-prop">index</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#status-attached-prop">status</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qt-labs-controls-stackview.html#view-attached-prop">view</a></b></b> : StackView</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">void <b><b><a href="qml-qt-labs-controls-stackview.html#clear-method">clear</a></b></b>()</li>
<li class="fn">Item <b><b><a href="qml-qt-labs-controls-stackview.html#find-method">find</a></b></b>(<i>callback</i>, <i>behavior</i>)</li>
<li class="fn">Item <b><b><a href="qml-qt-labs-controls-stackview.html#get-method">get</a></b></b>(<i>index</i>, <i>behavior</i>)</li>
<li class="fn">Item <b><b><a href="qml-qt-labs-controls-stackview.html#pop-method">pop</a></b></b>(<i>item</i>, <i>operation</i>)</li>
<li class="fn">Item <b><b><a href="qml-qt-labs-controls-stackview.html#push-method">push</a></b></b>(<i>item</i>, <i>properties</i>, <i>operation</i>)</li>
<li class="fn">Item <b><b><a href="qml-qt-labs-controls-stackview.html#replace-method">replace</a></b></b>(<i>target</i>, <i>item</i>, <i>properties</i>, <i>operation</i>)</li>
</ul>
<!-- $$$StackView-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
</p>
<p class="centerAlign"><img src="images/qtlabscontrols-stackview-wireframe.png" alt="" /></p><p><a href="qml-qt-labs-controls-stackview.html">StackView</a> can be used with a set of inter-linked information pages. For example, an email application with separate views to list latest emails, view a specific email, and list/view the attachments. The email list view is pushed onto the stack as users open an email, and popped out as they choose to go back.</p>
<p>The following snippet demonstrates a simple use case, where the <code>mainView</code> is pushed onto and popped out of the stack on relevant button click:</p>
<pre class="qml">

  <span class="type"><a href="qml-qt-labs-controls-applicationwindow.html">ApplicationWindow</a></span> {
      <span class="name">title</span>: <span class="name">qsTr</span>(<span class="string">&quot;Hello World&quot;</span>)
      <span class="name">width</span>: <span class="number">640</span>
      <span class="name">height</span>: <span class="number">480</span>
      <span class="name">visible</span>: <span class="number">true</span>

      <span class="type"><a href="qml-qt-labs-controls-stackview.html">StackView</a></span> {
          <span class="name">id</span>: <span class="name">stack</span>
          <span class="name">initialItem</span>: <span class="name">mainView</span>
          <span class="name">anchors</span>.fill: <span class="name">parent</span>
      }

      <span class="type">Component</span> {
          <span class="name">id</span>: <span class="name">mainView</span>

          <span class="type">Row</span> {
              <span class="name">spacing</span>: <span class="number">10</span>

              <span class="type"><a href="qml-qt-labs-controls-button.html">Button</a></span> {
                  <span class="name">text</span>: <span class="string">&quot;Push&quot;</span>
                  <span class="name">onClicked</span>: <span class="name">stack</span>.<span class="name">push</span>(<span class="name">mainView</span>)
              }
              <span class="type"><a href="qml-qt-labs-controls-button.html">Button</a></span> {
                  <span class="name">text</span>: <span class="string">&quot;Pop&quot;</span>
                  <span class="name">enabled</span>: <span class="name">stack</span>.<span class="name">depth</span> <span class="operator">&gt;</span> <span class="number">1</span>
                  <span class="name">onClicked</span>: <span class="name">stack</span>.<span class="name">pop</span>()

              }
              <span class="type">Text</span> {
                  <span class="name">text</span>: <span class="name">stack</span>.<span class="name">depth</span>
              }
          }
      }
  }

</pre>
<a name="using-stackview-in-an-application"></a>
<h2 id="using-stackview-in-an-application">Using StackView in an Application</h2>
<p>Using <a href="qml-qt-labs-controls-stackview.html">StackView</a> in an application is as simple as adding it as a child to a Window. The stack is usually anchored to the edges of the window, except at the top or bottom where it might be anchored to a status bar, or some other similar UI component. The stack can then be used by invoking its navigation methods. The first item to show in the <a href="qml-qt-labs-controls-stackview.html">StackView</a> is the one that was assigned to <a href="qml-qt-labs-controls-stackview.html#initialItem-prop">initialItem</a>, or the topmost item if <a href="qml-qt-labs-controls-stackview.html#initialItem-prop">initialItem</a> is not set.</p>
<a name="basic-navigation"></a>
<h2 id="basic-navigation">Basic Navigation</h2>
<p><a href="qml-qt-labs-controls-stackview.html">StackView</a> supports three primary navigation operations: <a href="qml-qt-labs-controls-stackview.html#push-method">push()</a>, <a href="qml-qt-labs-controls-stackview.html#pop-method">pop()</a>, and <a href="qml-qt-labs-controls-stackview.html#replace-method">replace()</a>. These correspond to classic stack operations where &quot;push&quot; adds an item to the top of a stack, &quot;pop&quot; removes the top item from the stack, and &quot;replace&quot; is like a pop followed by a push, which replaces the topmost item with the new item. The topmost item in the stack corresponds to the one that is <a href="qml-qt-labs-controls-stackview.html#currentItem-prop">currently</a> visible on screen. Logically, &quot;push&quot; navigates forward or deeper into the application UI, &quot;pop&quot; navigates backward, and &quot;replace&quot; replaces the <a href="qml-qt-labs-controls-stackview.html#currentItem-prop">currentItem</a>.</p>
<p>Sometimes, it is necessary to go back more than a single step in the stack. For example, to return to a &quot;main&quot; item or some kind of section item in the application. In such cases, it is possible to specify an item as a parameter for <a href="qml-qt-labs-controls-stackview.html#pop-method">pop()</a>. This is called an &quot;unwind&quot; operation, where the stack unwinds till the specified item. If the item is not found, stack unwinds until it is left with one item, which becomes the <a href="qml-qt-labs-controls-stackview.html#currentItem-prop">currentItem</a>. To explicitly unwind to the bottom of the stack, it is recommended to use <a href="qml-qt-labs-controls-stackview.html#pop-method">pop(null)</a>, although any non-existent item will do.</p>
<p>Given the stack [A, B, C]:</p>
<ul>
<li><a href="qml-qt-labs-controls-stackview.html#push-method">push(D)</a> =&gt; [A, B, C, D] - &quot;push&quot; transition animation between C and D</li>
<li><a href="qml-qt-labs-controls-stackview.html#pop-method">pop()</a> =&gt; [A, B] - &quot;pop&quot; transition animation between C and B</li>
<li><a href="qml-qt-labs-controls-stackview.html#replace-method">replace(D)</a> =&gt; [A, B, D] - &quot;replace&quot; transition between C and D</li>
<li><a href="qml-qt-labs-controls-stackview.html#pop-method">pop(A)</a> =&gt; [A] - &quot;pop&quot; transition between C and A</li>
</ul>
<p><b>Note: </b>When the stack is empty, a <a href="qml-qt-labs-controls-stackview.html#push-method">push()</a> operation will not have a transition animation because there is nothing to transition from (typically on application start-up). A <a href="qml-qt-labs-controls-stackview.html#pop-method">pop()</a> operation on a stack with depth 1 or 0 does nothing. In such cases, the stack can be emptied using the <a href="qml-qt-labs-controls-stackview.html#clear-method">clear()</a> method.</p><a name="deep-linking"></a>
<h2 id="deep-linking">Deep Linking</h2>
<p><i>Deep linking</i> means launching an application into a particular state. For example, a newspaper application could be launched into showing a particular article, bypassing the topmost item. In terms of <a href="qml-qt-labs-controls-stackview.html">StackView</a>, deep linking means the ability to modify the state of the stack, so much so that it is possible to push a set of items to the top of the stack, or to completely reset the stack to a given state.</p>
<p>The API for deep linking in <a href="qml-qt-labs-controls-stackview.html">StackView</a> is the same as for basic navigation. Pushing an array instead of a single item adds all the items in that array to the stack. The transition animation, however, is applied only for the last item in the array. The normal semantics of <a href="qml-qt-labs-controls-stackview.html#push-method">push()</a> apply for deep linking, that is, it adds whatever is pushed onto the stack.</p>
<p><b>Note: </b>Only the last item of the array is loaded. The rest of the items are loaded only when needed, either on subsequent calls to pop or on request to get an item using <a href="qml-qt-labs-controls-stackview.html#get-method">get()</a>.</p><p>This gives us the following result, given the stack [A, B, C]:</p>
<ul>
<li><a href="qml-qt-labs-controls-stackview.html#push-method">push([D, E, F])</a> =&gt; [A, B, C, D, E, F] - &quot;push&quot; transition animation between C and F</li>
<li><a href="qml-qt-labs-controls-stackview.html#replace-method">replace([D, E, F])</a> =&gt; [A, B, D, E, F] - &quot;replace&quot; transition animation between C and F</li>
<li><a href="qml-qt-labs-controls-stackview.html#clear-method">clear()</a> followed by <a href="qml-qt-labs-controls-stackview.html#push-method">push([D, E, F])</a> =&gt; [D, E, F] - no transition animation for pushing items as the stack was empty.</li>
</ul>
<a name="finding-items"></a>
<h2 id="finding-items">Finding Items</h2>
<p>An Item for which the application does not have a reference can be found by calling <a href="qml-qt-labs-controls-stackview.html#find-method">find()</a>. The method needs a callback function, which is invoked for each item in the stack (starting at the top) until a match is found. If the callback returns <code>true</code>, <a href="qml-qt-labs-controls-stackview.html#find-method">find()</a> stops and returns the matching item, otherwise <code>null</code> is returned.</p>
<p>The code below searches the stack for an item named &quot;order_id&quot; and unwinds to that item.</p>
<pre class="cpp">

  stackView.pop(stackView.find(function(item) {
      return item.name == &quot;order_id&quot;;
  }));

</pre>
<p>You can also get to an item in the stack using <a href="qml-qt-labs-controls-stackview.html#get-method">get(index)</a>.</p>
<pre class="cpp">

  previousItem = stackView.get(myItem.StackView.index - 1));

</pre>
<a name="transitions"></a>
<h2 id="transitions">Transitions</h2>
<p>For each push or pop operation, different transition animations are applied to entering and exiting items. These animations define how the entering item should animate in, and the exiting item should animate out. The animations can be customized by assigning different Transitions for the <a href="qml-qt-labs-controls-stackview.html#pushEnter-prop">pushEnter</a>, <a href="qml-qt-labs-controls-stackview.html#pushExit-prop">pushExit</a>, <a href="qml-qt-labs-controls-stackview.html#popEnter-prop">popEnter</a>, <a href="qml-qt-labs-controls-stackview.html#popExit-prop">popExit</a>, <a href="qml-qt-labs-controls-stackview.html#replaceEnter-prop">replaceEnter</a>, and <a href="qml-qt-labs-controls-stackview.html#replaceExit-prop">replaceExit</a> properties of <a href="qml-qt-labs-controls-stackview.html">StackView</a>.</p>
<p><b>Note: </b>The transition animations affect each others' transitional behavior. Customizing the animation for one and leaving the other may give unexpected results.</p><p>The following snippet defines a simple fade transition for push and pop operations:</p>
<pre class="qml">

  <span class="type"><a href="qml-qt-labs-controls-stackview.html">StackView</a></span> {
      <span class="name">id</span>: <span class="name">stackview</span>
      <span class="name">anchors</span>.fill: <span class="name">parent</span>

      <span class="name">pushEnter</span>: <span class="name">Transition</span> {
          <span class="type">PropertyAnimation</span> {
              <span class="name">property</span>: <span class="string">&quot;opacity&quot;</span>
              <span class="name">from</span>: <span class="number">0</span>
              <span class="name">to</span>:<span class="number">1</span>
              <span class="name">duration</span>: <span class="number">200</span>
          }
      }
      <span class="name">pushExit</span>: <span class="name">Transition</span> {
          <span class="type">PropertyAnimation</span> {
              <span class="name">property</span>: <span class="string">&quot;opacity&quot;</span>
              <span class="name">from</span>: <span class="number">1</span>
              <span class="name">to</span>:<span class="number">0</span>
              <span class="name">duration</span>: <span class="number">200</span>
          }
      }
      <span class="name">popEnter</span>: <span class="name">Transition</span> {
          <span class="type">PropertyAnimation</span> {
              <span class="name">property</span>: <span class="string">&quot;opacity&quot;</span>
              <span class="name">from</span>: <span class="number">0</span>
              <span class="name">to</span>:<span class="number">1</span>
              <span class="name">duration</span>: <span class="number">200</span>
          }
      }
      <span class="name">popExit</span>: <span class="name">Transition</span> {
          <span class="type">PropertyAnimation</span> {
              <span class="name">property</span>: <span class="string">&quot;opacity&quot;</span>
              <span class="name">from</span>: <span class="number">1</span>
              <span class="name">to</span>:<span class="number">0</span>
              <span class="name">duration</span>: <span class="number">200</span>
          }
      }
  }

</pre>
<p><b>Note: </b>Using anchors on the items added to a <a href="qml-qt-labs-controls-stackview.html">StackView</a> is not supported. Typically push, pop, and replace transitions animate the position, which is not possible when anchors are applied. Notice that this only applies to the root of the item. Using anchors for its children works as expected.</p><p><b>Note: </b><i>Types in the Qt.labs module are not guaranteed to remain compatible in future versions.</i></p><p><b>See also </b><a href="qtlabscontrols-customize.html#customizing-stackview">Customizing StackView</a>, <a href="qtlabscontrols-navigation.html">Navigation Controls</a>, and <a href="qtlabscontrols-containers.html">Container Controls</a>.</p>
<!-- @@@StackView -->
<h2>Property Documentation</h2>
<!-- $$$busy -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="busy-prop">
<td class="tblQmlPropNode"><p>
<a name="busy-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">busy</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds whether a transition is running.</p>
</div></div><!-- @@@busy -->
<br/>
<!-- $$$currentItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="currentItem-prop">
<td class="tblQmlPropNode"><p>
<a name="currentItem-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">currentItem</span> : <span class="type">Item</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the current top-most item in the stack.</p>
</div></div><!-- @@@currentItem -->
<br/>
<!-- $$$depth -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="depth-prop">
<td class="tblQmlPropNode"><p>
<a name="depth-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">depth</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the number of items currently pushed onto the stack.</p>
</div></div><!-- @@@depth -->
<br/>
<!-- $$$initialItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="initialItem-prop">
<td class="tblQmlPropNode"><p>
<a name="initialItem-prop"></a><span class="name">initialItem</span> : <span class="type">var</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the initial item that should be shown when the <a href="qml-qt-labs-controls-stackview.html">StackView</a> is created. The initial item can be an Item, Component, or a url. Specifying an initial item is equivalent to:</p>
<pre class="cpp">

  Component<span class="operator">.</span>onCompleted: stackView<span class="operator">.</span>push(myInitialItem)

</pre>
<p><b>See also </b><a href="qml-qt-labs-controls-stackview.html#push-method">push()</a>.</p>
</div></div><!-- @@@initialItem -->
<br/>
<!-- $$$popEnter -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="popEnter-prop">
<td class="tblQmlPropNode"><p>
<a name="popEnter-prop"></a><span class="name">popEnter</span> : <span class="type">Transition</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition that is applied to the item that enters the stack when another item is popped off of it.</p>
<p><b>See also </b><a href="qtlabscontrols-customize.html#customizing-stackview">Customizing StackView</a>.</p>
</div></div><!-- @@@popEnter -->
<br/>
<!-- $$$popExit -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="popExit-prop">
<td class="tblQmlPropNode"><p>
<a name="popExit-prop"></a><span class="name">popExit</span> : <span class="type">Transition</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition that is applied to the item that exits the stack when the item is popped off of it.</p>
<p><b>See also </b><a href="qtlabscontrols-customize.html#customizing-stackview">Customizing StackView</a>.</p>
</div></div><!-- @@@popExit -->
<br/>
<!-- $$$pushEnter -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="pushEnter-prop">
<td class="tblQmlPropNode"><p>
<a name="pushEnter-prop"></a><span class="name">pushEnter</span> : <span class="type">Transition</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition that is applied to the item that enters the stack when the item is pushed onto it.</p>
<p><b>See also </b><a href="qtlabscontrols-customize.html#customizing-stackview">Customizing StackView</a>.</p>
</div></div><!-- @@@pushEnter -->
<br/>
<!-- $$$pushExit -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="pushExit-prop">
<td class="tblQmlPropNode"><p>
<a name="pushExit-prop"></a><span class="name">pushExit</span> : <span class="type">Transition</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition that is applied to the item that exits the stack when another item is pushed onto it.</p>
<p><b>See also </b><a href="qtlabscontrols-customize.html#customizing-stackview">Customizing StackView</a>.</p>
</div></div><!-- @@@pushExit -->
<br/>
<!-- $$$replaceEnter -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="replaceEnter-prop">
<td class="tblQmlPropNode"><p>
<a name="replaceEnter-prop"></a><span class="name">replaceEnter</span> : <span class="type">Transition</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition that is applied to the item that enters the stack when another item is replaced by it.</p>
<p><b>See also </b><a href="qtlabscontrols-customize.html#customizing-stackview">Customizing StackView</a>.</p>
</div></div><!-- @@@replaceEnter -->
<br/>
<!-- $$$replaceExit -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="replaceExit-prop">
<td class="tblQmlPropNode"><p>
<a name="replaceExit-prop"></a><span class="name">replaceExit</span> : <span class="type">Transition</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition that is applied to the item that exits the stack when it is replaced by another item.</p>
<p><b>See also </b><a href="qtlabscontrols-customize.html#customizing-stackview">Customizing StackView</a>.</p>
</div></div><!-- @@@replaceExit -->
<br/>
<h2>Attached Property Documentation</h2>
<!-- $$$index -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="index-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="index-attached-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">StackView.index</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the stack index of the item it's attached to, or <code>-1</code> if the item is not in a stack.</p>
</div></div><!-- @@@index -->
<br/>
<!-- $$$status -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="status-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="status-attached-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">StackView.status</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the stack status of the item it's attached to, or <code>StackView.Inactive</code> if the item is not in a stack.</p>
<p>Available values:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>StackView.Inactive</code></td><td class="topAlign">The item is inactive (or not in a stack).</td></tr>
<tr><td class="topAlign"><code>StackView.Deactivating</code></td><td class="topAlign">The item is being deactivated (popped off).</td></tr>
<tr><td class="topAlign"><code>StackView.Activating</code></td><td class="topAlign">The item is being activated (becoming the current item).</td></tr>
<tr><td class="topAlign"><code>StackView.Active</code></td><td class="topAlign">The item is active, that is, the current item.</td></tr>
</table></div>
</div></div><!-- @@@status -->
<br/>
<!-- $$$view -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="view-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="view-attached-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">StackView.view</span> : <span class="type"><a href="qml-qt-labs-controls-stackview.html">StackView</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the stack view of the item it's attached to, or <code>null</code> if the item is not in a stack.</p>
</div></div><!-- @@@view -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$clear -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="clear-method">
<td class="tblQmlFuncNode"><p>
<a name="clear-method"></a><span class="type">void</span> <span class="name">clear</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Removes all items from the stack. No animations are applied.</p>
</div></div><!-- @@@clear -->
<br/>
<!-- $$$find -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="find-method">
<td class="tblQmlFuncNode"><p>
<a name="find-method"></a><span class="type">Item</span> <span class="name">find</span>(<i>callback</i>, <i>behavior</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Search for a specific item inside the stack. The <i>callback</i> function is called for each item in the stack (with the item and index as arguments) until the callback function returns <code>true</code>. The return value is the item found. For example:</p>
<pre class="cpp">

  stackView<span class="operator">.</span>find(function(item<span class="operator">,</span> index) {
      <span class="keyword">return</span> item<span class="operator">.</span>isTheOne
  })

</pre>
<p>Supported behavior values:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>StackView.DontLoad</code></td><td class="topAlign">Unloaded items are skipped (the callback function is not called for them).</td></tr>
<tr><td class="topAlign"><code>StackView.ForceLoad</code></td><td class="topAlign">Unloaded items are forced to load.</td></tr>
</table></div>
</div></div><!-- @@@find -->
<br/>
<!-- $$$get -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="get-method">
<td class="tblQmlFuncNode"><p>
<a name="get-method"></a><span class="type">Item</span> <span class="name">get</span>(<i>index</i>, <i>behavior</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the item at position <i>index</i> in the stack, or <code>null</code> if the index is out of bounds.</p>
<p>Supported behavior values:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>StackView.DontLoad</code></td><td class="topAlign">The item is not forced to load (and <code>null</code> is returned if not yet loaded).</td></tr>
<tr><td class="topAlign"><code>StackView.ForceLoad</code></td><td class="topAlign">The item is forced to load.</td></tr>
</table></div>
</div></div><!-- @@@get -->
<br/>
<!-- $$$pop -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="pop-method">
<td class="tblQmlFuncNode"><p>
<a name="pop-method"></a><span class="type">Item</span> <span class="name">pop</span>(<i>item</i>, <i>operation</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Pops one or more items off the stack. Returns the last item removed from the stack.</p>
<p>If the <i>item</i> argument is specified, all items down to (but not including) <i>item</i> will be popped. If <i>item</i> is <code>null</code>, all items down to (but not including) the first item is popped. If not specified, only the current item is popped.</p>
<p>An <i>operation</i> can be optionally specified as the last argument. Supported operations:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>StackView.Transition</code></td><td class="topAlign">An operation with transitions.</td></tr>
<tr><td class="topAlign"><code>StackView.Immediate</code></td><td class="topAlign">An immediate operation without transitions.</td></tr>
</table></div>
<p>Examples:</p>
<pre class="cpp">

  stackView<span class="operator">.</span>pop()
  stackView<span class="operator">.</span>pop(someItem<span class="operator">,</span> StackView<span class="operator">.</span>Immediate)
  stackView<span class="operator">.</span>pop(StackView<span class="operator">.</span>Immediate)
  stackView<span class="operator">.</span>pop(null)

</pre>
<p><b>See also </b><a href="qml-qt-labs-controls-stackview.html#clear-method">clear()</a>.</p>
</div></div><!-- @@@pop -->
<br/>
<!-- $$$push -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="push-method">
<td class="tblQmlFuncNode"><p>
<a name="push-method"></a><span class="type">Item</span> <span class="name">push</span>(<i>item</i>, <i>properties</i>, <i>operation</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Pushes an <i>item</i> onto the stack using the specified <i>operation</i>, and optionally applies a set of <i>properties</i> on the item. The item can be an Item, Component, or a url. Returns the item that became current.</p>
<p>Pushing a single item:</p>
<pre class="cpp">

  stackView<span class="operator">.</span>push(rect)

  <span class="comment">// or with properties:</span>
  stackView<span class="operator">.</span>push(rect<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;red&quot;</span>})

</pre>
<p>Multiple items can be pushed at the same time either by passing them as additional arguments, or as an array. The last item becomes the current item. Each item can be followed by a set of properties to apply.</p>
<p>Passing a variable amount of arguments:</p>
<pre class="cpp">

  stackView<span class="operator">.</span>push(rect1<span class="operator">,</span> rect2<span class="operator">,</span> rect3)

  <span class="comment">// or with properties:</span>
  stackView<span class="operator">.</span>push(rect1<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;red&quot;</span>}<span class="operator">,</span> rect2<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;green&quot;</span>}<span class="operator">,</span> rect3<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;blue&quot;</span>})

</pre>
<p>Pushing an array of items:</p>
<pre class="cpp">

  stackView<span class="operator">.</span>push(<span class="operator">[</span>rect1<span class="operator">,</span> rect2<span class="operator">,</span> rect3<span class="operator">]</span>)

  <span class="comment">// or with properties:</span>
  stackView<span class="operator">.</span>push(<span class="operator">[</span>rect1<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;red&quot;</span>}<span class="operator">,</span> rect2<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;green&quot;</span>}<span class="operator">,</span> rect3<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;blue&quot;</span>}<span class="operator">]</span>)

</pre>
<p>An <i>operation</i> can be optionally specified as the last argument. Supported operations:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>StackView.Transition</code></td><td class="topAlign">An operation with transitions.</td></tr>
<tr><td class="topAlign"><code>StackView.Immediate</code></td><td class="topAlign">An immediate operation without transitions.</td></tr>
</table></div>
<p><b>See also </b><a href="qml-qt-labs-controls-stackview.html#initialItem-prop">initialItem</a>.</p>
</div></div><!-- @@@push -->
<br/>
<!-- $$$replace -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="replace-method">
<td class="tblQmlFuncNode"><p>
<a name="replace-method"></a><span class="type">Item</span> <span class="name">replace</span>(<i>target</i>, <i>item</i>, <i>properties</i>, <i>operation</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Replaces one or more items on the stack with the specified <i>item</i> and <i>operation</i>, and optionally applies a set of <i>properties</i> on the item. The item can be an Item, Component, or a url. Returns the item that became current.</p>
<p>If the <i>target</i> argument is specified, all items down to the <a name=""></a> item will be replaced. If <i>target</i> is <code>null</code>, all items in the stack will be replaced. If not specified, only the top item will be replaced.</p>
<p>Replace the top item:</p>
<pre class="cpp">

  stackView<span class="operator">.</span>replace(rect)

  <span class="comment">// or with properties:</span>
  stackView<span class="operator">.</span>replace(rect<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;red&quot;</span>})

</pre>
<p>Multiple items can be replaced at the same time either by passing them as additional arguments, or as an array. Each item can be followed by a set of properties to apply.</p>
<p>Passing a variable amount of arguments:</p>
<pre class="cpp">

  stackView<span class="operator">.</span>replace(rect1<span class="operator">,</span> rect2<span class="operator">,</span> rect3)

  <span class="comment">// or with properties:</span>
  stackView<span class="operator">.</span>replace(rect1<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;red&quot;</span>}<span class="operator">,</span> rect2<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;green&quot;</span>}<span class="operator">,</span> rect3<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;blue&quot;</span>})

</pre>
<p>Replacing an array of items:</p>
<pre class="cpp">

  stackView<span class="operator">.</span>replace(<span class="operator">[</span>rect1<span class="operator">,</span> rect2<span class="operator">,</span> rect3<span class="operator">]</span>)

  <span class="comment">// or with properties:</span>
  stackView<span class="operator">.</span>replace(<span class="operator">[</span>rect1<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;red&quot;</span>}<span class="operator">,</span> rect2<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;green&quot;</span>}<span class="operator">,</span> rect3<span class="operator">,</span> {<span class="string">&quot;color&quot;</span>: <span class="string">&quot;blue&quot;</span>}<span class="operator">]</span>)

</pre>
<p>An <i>operation</i> can be optionally specified as the last argument. Supported operations:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>StackView.Transition</code></td><td class="topAlign">An operation with transitions.</td></tr>
<tr><td class="topAlign"><code>StackView.Immediate</code></td><td class="topAlign">An immediate operation without transitions.</td></tr>
</table></div>
<p><b>See also </b><a href="qml-qt-labs-controls-stackview.html#push-method">push()</a>.</p>
</div></div><!-- @@@replace -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2016 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>