Sophie

Sophie

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

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" />
<!-- qquicklistview.cpp -->
  <title>ListView QML Type | 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 ><a href="qtquick-qmlmodule.html">QML Types</a></td><td >ListView QML Type</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="#properties">Properties</a></li>
<li class="level1"><a href="#attached-properties">Attached Properties</a></li>
<li class="level1"><a href="#attached-signals">Attached Signals</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="#example-usage">Example Usage</a></li>
<li class="level2"><a href="#listview-layouts">ListView Layouts</a></li>
<li class="level2"><a href="#flickable-direction">Flickable Direction</a></li>
<li class="level2"><a href="#stacking-order-in-listview">Stacking Order in ListView</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">ListView QML Type</h1>
<span class="subtitle"></span>
<!-- $$$ListView-brief -->
<p>Provides a list view of items provided by a model. <a href="#details">More...</a></p>
<!-- @@@ListView -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick 2.12</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-flickable.html">Flickable</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-listview-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-listview.html#add-prop">add</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#addDisplaced-prop">addDisplaced</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#cacheBuffer-prop">cacheBuffer</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#count-prop">count</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#currentIndex-prop">currentIndex</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#currentItem-prop">currentItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#currentSection-prop">currentSection</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#delegate-prop">delegate</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#displaced-prop">displaced</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#displayMarginBeginning-prop">displayMarginBeginning</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#displayMarginEnd-prop">displayMarginEnd</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#effectiveLayoutDirection-prop">effectiveLayoutDirection</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#footer-prop">footer</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#footerItem-prop">footerItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#footerPositioning-prop">footerPositioning</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#header-prop">header</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#headerItem-prop">headerItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#headerPositioning-prop">headerPositioning</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#highlight-prop">highlight</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#highlightItem-prop">highlightItem</a></b></b> : Item</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#highlightMoveDuration-prop">highlightMoveDuration</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#highlightMoveVelocity-prop">highlightMoveVelocity</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#highlightRangeMode-prop">highlightRangeMode</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#highlightResizeDuration-prop">highlightResizeDuration</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#highlightResizeVelocity-prop">highlightResizeVelocity</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#keyNavigationEnabled-prop">keyNavigationEnabled</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#keyNavigationWraps-prop">keyNavigationWraps</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#layoutDirection-prop">layoutDirection</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#model-prop">model</a></b></b> : model</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#move-prop">move</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#moveDisplaced-prop">moveDisplaced</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#orientation-prop">orientation</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#populate-prop">populate</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#preferredHighlightBegin-prop">preferredHighlightBegin</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#preferredHighlightEnd-prop">preferredHighlightEnd</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#remove-prop">remove</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#removeDisplaced-prop">removeDisplaced</a></b></b> : Transition</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#section-prop">section</a></b></b><ul>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#section.property-prop">section.property</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#section.criteria-prop">section.criteria</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#section.delegate-prop">section.delegate</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#section.labelPositioning-prop">section.labelPositioning</a></b></b> : enumeration</li>
</ul>
</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#snapMode-prop">snapMode</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#spacing-prop">spacing</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#verticalLayoutDirection-prop">verticalLayoutDirection</a></b></b> : enumeration</li>
</ul>
<a name="attached-properties"></a>
<h2 id="attached-properties">Attached Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#delayRemove-attached-prop">delayRemove</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#isCurrentItem-attached-prop">isCurrentItem</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#nextSection-attached-prop">nextSection</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#previousSection-attached-prop">previousSection</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#section-attached-prop">section</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#view-attached-prop">view</a></b></b> : ListView</li>
</ul>
<a name="attached-signals"></a>
<h2 id="attached-signals">Attached Signals</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#add-signal">add</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#remove-signal">remove</a></b></b>()</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#decrementCurrentIndex-method">decrementCurrentIndex</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#forceLayout-method">forceLayout</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#incrementCurrentIndex-method">incrementCurrentIndex</a></b></b>()</li>
<li class="fn">int <b><b><a href="qml-qtquick-listview.html#indexAt-method">indexAt</a></b></b>(real <i>x</i>,  real <i>y</i>)</li>
<li class="fn">Item <b><b><a href="qml-qtquick-listview.html#itemAt-method">itemAt</a></b></b>(real <i>x</i>,  real <i>y</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#positionViewAtBeginning-method">positionViewAtBeginning</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#positionViewAtEnd-method">positionViewAtEnd</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-listview.html#positionViewAtIndex-method">positionViewAtIndex</a></b></b>(int <i>index</i>,  PositionMode <i>mode</i>)</li>
</ul>
<!-- $$$ListView-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p>A <a href="qml-qtquick-listview.html">ListView</a> displays data from models created from built-in QML types like ListModel and XmlListModel, or custom model classes defined in C++ that inherit from QAbstractItemModel or QAbstractListModel.</p>
<p>A <a href="qml-qtquick-listview.html">ListView</a> has a <a href="qml-qtquick-listview.html#model-prop">model</a>, which defines the data to be displayed, and a <a href="qml-qtquick-listview.html#delegate-prop">delegate</a>, which defines how the data should be displayed. Items in a <a href="qml-qtquick-listview.html">ListView</a> are laid out horizontally or vertically. List views are inherently flickable because <a href="qml-qtquick-listview.html">ListView</a> inherits from <a href="qml-qtquick-flickable.html">Flickable</a>.</p>
<a name="example-usage"></a>
<h2 id="example-usage">Example Usage</h2>
<p>The following example shows the definition of a simple list model defined in a file called <code>ContactModel.qml</code>:</p>
<pre class="qml">

  import QtQuick 2.0

  ListModel {
      ListElement {
          name: "Bill Smith"
          number: "555 3264"
      }
      ListElement {
          name: "John Brown"
          number: "555 8426"
      }
      ListElement {
          name: "Sam Wise"
          number: "555 0473"
      }
  }

</pre>
<p>Another component can display this model data in a <a href="qml-qtquick-listview.html">ListView</a>, like this:</p>
<pre class="qml">

  import QtQuick 2.0

  ListView {
      width: 180; height: 200

      model: ContactModel {}
      delegate: Text {
          text: name + ": " + number
      }
  }

</pre>
<p class="centerAlign"><img src="images/listview-simple.png" alt="" /></p><p>Here, the <a href="qml-qtquick-listview.html">ListView</a> creates a <code>ContactModel</code> component for its model, and a <a href="qml-qtquick-text.html">Text</a> item for its delegate. The view will create a new <a href="qml-qtquick-text.html">Text</a> component for each item in the model. Notice the delegate is able to access the model's <code>name</code> and <code>number</code> data directly.</p>
<p>An improved list view is shown below. The delegate is visually improved and is moved into a separate <code>contactDelegate</code> component.</p>
<pre class="qml">

  Rectangle {
      width: 180; height: 200

      Component {
          id: contactDelegate
          Item {
              width: 180; height: 40
              Column {
                  Text { text: '<b>Name:</b> ' + name }
                  Text { text: '<b>Number:</b> ' + number }
              }
          }
      }

      ListView {
          anchors.fill: parent
          model: ContactModel {}
          delegate: contactDelegate
          highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
          focus: true
      }
  }

</pre>
<p class="centerAlign"><img src="images/listview-highlight.png" alt="" /></p><p>The currently selected item is highlighted with a blue <a href="qml-qtquick-rectangle.html">Rectangle</a> using the <a href="qtquick-views-example.html#highlight">highlight</a> property, and <code>focus</code> is set to <code>true</code> to enable keyboard navigation for the list view. The list view itself is a focus scope (see <a href="qtquick-input-focus.html">Keyboard Focus in Qt Quick</a> for more details).</p>
<p>Delegates are instantiated as needed and may be destroyed at any time. They are parented to <a href="qml-qtquick-listview.html">ListView</a>'s <a href="qml-qtquick-flickable.html#contentItem-prop">contentItem</a>, not to the view itself. State should <i>never</i> be stored in a delegate.</p>
<p><a href="qml-qtquick-listview.html">ListView</a> attaches a number of properties to the root item of the delegate, for example <code>ListView.isCurrentItem</code>. In the following example, the root delegate item can access this attached property directly as <code>ListView.isCurrentItem</code>, while the child <code>contactInfo</code> object must refer to this property as <code>wrapper.ListView.isCurrentItem</code>.</p>
<pre class="qml">

  ListView {
      width: 180; height: 200

      Component {
          id: contactsDelegate
          Rectangle {
              id: wrapper
              width: 180
              height: contactInfo.height
              color: ListView.isCurrentItem ? "black" : "red"
              Text {
                  id: contactInfo
                  text: name + ": " + number
                  color: wrapper.ListView.isCurrentItem ? "red" : "black"
              }
          }
      }

      model: ContactModel {}
      delegate: contactsDelegate
      focus: true
  }

</pre>
<p><b>Note: </b>Views do not enable <i>clip</i> automatically. If the view is not clipped by another item or the screen, it will be necessary to set <i>clip: true</i> in order to have the out of view items clipped nicely.</p><a name="listview-layouts"></a>
<h2 id="listview-layouts">ListView Layouts</h2>
<p>The layout of the items in a <a href="qml-qtquick-listview.html">ListView</a> can be controlled by these properties:</p>
<ul>
<li><a href="qml-qtquick-listview.html#orientation-prop">orientation</a> - controls whether items flow horizontally or vertically. This value can be either Qt.Horizontal or Qt.Vertical.</li>
<li><a href="qml-qtquick-listview.html#layoutDirection-prop">layoutDirection</a> - controls the horizontal layout direction for a horizontally-oriented view: that is, whether items are laid out from the left side of the view to the right, or vice-versa. This value can be either Qt.LeftToRight or Qt.RightToLeft.</li>
<li><a href="qml-qtquick-listview.html#verticalLayoutDirection-prop">verticalLayoutDirection</a> - controls the vertical layout direction for a vertically-oriented view: that is, whether items are laid out from the top of the view down towards the bottom of the view, or vice-versa. This value can be either <a href="qml-qtquick-listview.html">ListView</a>.TopToBottom or <a href="qml-qtquick-listview.html">ListView</a>.BottomToTop.</li>
</ul>
<p>By default, a <a href="qml-qtquick-listview.html">ListView</a> has a vertical orientation, and items are laid out from top to bottom. The table below shows the different layouts that a <a href="qml-qtquick-listview.html">ListView</a> can have, depending on the values of the properties listed above.</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th  colspan="2" rowspan=" 1"><b>ListViews</b> with Qt.Vertical orientation</th></tr></thead>
<tr valign="top" class="odd"><td >Top to bottom<p class="centerAlign"><img src="images/listview-layout-toptobottom.png" alt="" /></p></td><td >Bottom to top<p class="centerAlign"><img src="images/listview-layout-bottomtotop.png" alt="" /></p></td></tr>
<thead><tr class="qt-style"><th  colspan="2" rowspan=" 1"><b>ListViews</b> with Qt.Horizontal orientation</th></tr></thead>
<tr valign="top" class="even"><td >Left to right<p class="centerAlign"><img src="images/listview-layout-lefttoright.png" alt="" /></p></td><td >Right to left<p class="centerAlign"><img src="images/listview-layout-righttoleft.png" alt="" /></p></td></tr>
</table></div>
<a name="flickable-direction"></a>
<h2 id="flickable-direction">Flickable Direction</h2>
<p>By default, a vertical <a href="qml-qtquick-listview.html">ListView</a> sets <a href="qml-qtquick-flickable.html#flickableDirection-prop">flickableDirection</a> to <i>Flickable.Vertical</i>, and a horizontal <a href="qml-qtquick-listview.html">ListView</a> sets it to <i>Flickable.Horizontal</i>. Furthermore, a vertical <a href="qml-qtquick-listview.html">ListView</a> only calculates (estimates) the <a href="qml-qtquick-flickable.html#contentHeight-prop">contentHeight</a>, and a horizontal <a href="qml-qtquick-listview.html">ListView</a> only calculates the <a href="qml-qtquick-flickable.html#contentWidth-prop">contentWidth</a>. The other dimension is set to <i>-1</i>.</p>
<p>Since Qt 5.9 (Qt Quick 2.9), it is possible to make a <a href="qml-qtquick-listview.html">ListView</a> that can be flicked to both directions. In order to do this, the <a href="qml-qtquick-flickable.html#flickableDirection-prop">flickableDirection</a> can be set to <i>Flickable.AutoFlickDirection</i> or <i>Flickable.AutoFlickIfNeeded</i>, and the desired <i>contentWidth</i> or <i>contentHeight</i> must be provided.</p>
<pre class="qml">

  ListView {
      width: 180; height: 200

      contentWidth: 320
      flickableDirection: Flickable.AutoFlickDirection

      model: ContactModel {}
      delegate: Row {
          Text { text: '<b>Name:</b> ' + name; width: 160 }
          Text { text: '<b>Number:</b> ' + number; width: 160 }
      }
  }

</pre>
<a name="stacking-order-in-listview"></a>
<h2 id="stacking-order-in-listview">Stacking Order in ListView</h2>
<p>The <a href="qquickitem.html#z-prop">Z value</a> of items determines whether they are rendered above or below other items. <a href="qml-qtquick-listview.html">ListView</a> uses several different default Z values, depending on what type of item is being created:</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >Property</th><th >Default Z value</th></tr></thead>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-listview.html#delegate-prop">delegate</a></td><td >1</td></tr>
<tr valign="top" class="even"><td ><a href="qml-qtquick-listview.html#footer-prop">footer</a></td><td >1</td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-listview.html#header-prop">header</a></td><td >1</td></tr>
<tr valign="top" class="even"><td ><a href="qtquick-views-example.html#highlight">highlight</a></td><td >0</td></tr>
<tr valign="top" class="odd"><td ><a href="qml-qtquick-listview.html#section.delegate-prop">section.delegate</a></td><td >2</td></tr>
</table></div>
<p>These default values are set if the Z value of the item is <code>0</code>, so setting the Z value of these items to <code>0</code> has no effect. Note that the Z value is of type real, so it is possible to set fractional values like <code>0.1</code>.</p>
<p><b>See also </b><a href="qtquick-modelviewsdata-modelview.html#qml-data-models">QML Data Models</a>, <a href="qml-qtquick-gridview.html">GridView</a>, <a href="qml-qtquick-pathview.html">PathView</a>, and <a href="qtquick-views-example.html">Qt Quick Examples - Views</a>.</p>
<!-- @@@ListView -->
<h2>Property Documentation</h2>
<!-- $$$add -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="add-prop">
<td class="tblQmlPropNode"><p>
<a name="add-prop"></a><span class="name">add</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition to apply to items that are added to the view.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">

  ListView {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
      add: Transition {
          NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; from: <span class="number">100</span>; duration: <span class="number">1000</span> }
      }
  }

</pre>
<p>Whenever an item is added to the above view, the item will be animated from the position (100,100) to its final x,y position within the view, over one second. The transition only applies to the new items that are added to the view; it does not apply to the items below that are displaced by the addition of the new items. To animate the displaced items, set the <a href="qml-qtquick-listview.html#displaced-prop">displaced</a> or <a href="qml-qtquick-listview.html#addDisplaced-prop">addDisplaced</a> properties.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>Note: </b>This transition is not applied to the items that are created when the view is initially populated, or when the view's <a href="qml-qtquick-listview.html#model-prop">model</a> changes. (In those cases, the <a href="qml-qtquick-listview.html#populate-prop">populate</a> transition is applied instead.) Additionally, this transition should <i>not</i> animate the height of the new item; doing so will cause any items beneath the new item to be laid out at the wrong position. Instead, the height can be animated within the onAdd handler in the delegate.</p><p><b>See also </b><a href="qml-qtquick-listview.html#addDisplaced-prop">addDisplaced</a>, <a href="qml-qtquick-listview.html#populate-prop">populate</a>, and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@add -->
<br/>
<!-- $$$addDisplaced -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="addDisplaced-prop">
<td class="tblQmlPropNode"><p>
<a name="addDisplaced-prop"></a><span class="name">addDisplaced</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition to apply to items within the view that are displaced by the addition of other items to the view.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">

  ListView {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
      addDisplaced: Transition {
          NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
      }
  }

</pre>
<p>Whenever an item is added to the above view, all items beneath the new item are displaced, causing them to move down (or sideways, if horizontally orientated) within the view. As this displacement occurs, the items' movement to their new x,y positions within the view will be animated by a <a href="qml-qtquick-numberanimation.html">NumberAnimation</a> over one second, as specified. This transition is not applied to the new item that has been added to the view; to animate the added items, set the <a href="qml-qtquick-listview.html#add-prop">add</a> property.</p>
<p>If an item is displaced by multiple types of operations at the same time, it is not defined as to whether the addDisplaced, <a href="qml-qtquick-listview.html#moveDisplaced-prop">moveDisplaced</a> or <a href="qml-qtquick-listview.html#removeDisplaced-prop">removeDisplaced</a> transition will be applied. Additionally, if it is not necessary to specify different transitions depending on whether an item is displaced by an add, move or remove operation, consider setting the <a href="qml-qtquick-listview.html#displaced-prop">displaced</a> property instead.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>Note: </b>This transition is not applied to the items that are created when the view is initially populated, or when the view's <a href="qml-qtquick-listview.html#model-prop">model</a> changes. In those cases, the <a href="qml-qtquick-listview.html#populate-prop">populate</a> transition is applied instead.</p><p><b>See also </b><a href="qml-qtquick-listview.html#displaced-prop">displaced</a>, <a href="qml-qtquick-listview.html#add-prop">add</a>, <a href="qml-qtquick-listview.html#populate-prop">populate</a>, and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@addDisplaced -->
<br/>
<!-- $$$cacheBuffer -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="cacheBuffer-prop">
<td class="tblQmlPropNode"><p>
<a name="cacheBuffer-prop"></a><span class="name">cacheBuffer</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property determines whether delegates are retained outside the visible area of the view.</p>
<p>If this value is greater than zero, the view may keep as many delegates instantiated as it can fit within the buffer specified. For example, if in a vertical view the delegate is 20 pixels high and <code>cacheBuffer</code> is set to 40, then up to 2 delegates above and 2 delegates below the visible area may be created/retained. The buffered delegates are created asynchronously, allowing creation to occur across multiple frames and reducing the likelihood of skipping frames. In order to improve painting performance delegates outside the visible area are not painted.</p>
<p>The default value of this property is platform dependent, but will usually be a value greater than zero. Negative values are ignored.</p>
<p>Note that cacheBuffer is not a pixel buffer - it only maintains additional instantiated delegates.</p>
<p><b>Note: </b>Setting this property is not a replacement for creating efficient delegates. It can improve the smoothness of scrolling behavior at the expense of additional memory usage. The fewer objects and bindings in a delegate, the faster a view can be scrolled. It is important to realize that setting a cacheBuffer will only postpone issues caused by slow-loading delegates, it is not a solution for this scenario.</p><p>The cacheBuffer operates outside of any display margins specified by <a href="qml-qtquick-listview.html#displayMarginBeginning-prop">displayMarginBeginning</a> or <a href="qml-qtquick-listview.html#displayMarginEnd-prop">displayMarginEnd</a>.</p>
</div></div><!-- @@@cacheBuffer -->
<br/>
<!-- $$$count -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="count-prop">
<td class="tblQmlPropNode"><p>
<a name="count-prop"></a><span class="name">count</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the number of items in the view.</p>
</div></div><!-- @@@count -->
<br/>
<!-- $$$currentIndex -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="currentIndex-prop">
<td class="tblQmlPropNode"><p>
<a name="currentIndex-prop"></a><span class="name">currentIndex</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>currentIndex</code> property holds the index of the current item, and <code>currentItem</code> holds the current item. Setting the currentIndex to -1 will clear the highlight and set <a href="qml-qtquick-listview.html#currentItem-prop">currentItem</a> to null.</p>
<p>If <a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> is <code>true</code>, setting either of these properties will smoothly scroll the <a href="qml-qtquick-listview.html">ListView</a> so that the current item becomes visible.</p>
<p>Note that the position of the current item may only be approximate until it becomes visible in the view.</p>
</div></div><!-- @@@currentIndex -->
<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="name">currentItem</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>currentIndex</code> property holds the index of the current item, and <code>currentItem</code> holds the current item. Setting the <a href="qml-qtquick-listview.html#currentIndex-prop">currentIndex</a> to -1 will clear the highlight and set currentItem to null.</p>
<p>If <a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> is <code>true</code>, setting either of these properties will smoothly scroll the <a href="qml-qtquick-listview.html">ListView</a> so that the current item becomes visible.</p>
<p>Note that the position of the current item may only be approximate until it becomes visible in the view.</p>
</div></div><!-- @@@currentItem -->
<br/>
<!-- $$$currentSection -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="currentSection-prop">
<td class="tblQmlPropNode"><p>
<a name="currentSection-prop"></a><span class="name">currentSection</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the section that is currently at the beginning of the view.</p>
</div></div><!-- @@@currentSection -->
<br/>
<!-- $$$delegate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="delegate-prop">
<td class="tblQmlPropNode"><p>
<a name="delegate-prop"></a><span class="name">delegate</span> : <span class="type">Component</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The delegate provides a template defining each item instantiated by the view. The index is exposed as an accessible <code>index</code> property. Properties of the model are also available depending upon the type of <a href="qtquick-modelviewsdata-modelview.html#qml-data-models">Data Model</a>.</p>
<p>The number of objects and bindings in the delegate has a direct effect on the flicking performance of the view. If at all possible, place functionality that is not needed for the normal display of the delegate in a <a href="qml-qtquick-loader.html">Loader</a> which can load additional components when needed.</p>
<p>The <a href="qml-qtquick-listview.html">ListView</a> will lay out the items based on the size of the root item in the delegate.</p>
<p>It is recommended that the delegate's size be a whole number to avoid sub-pixel alignment of items.</p>
<p>The default <a href="qquickitem.html#z-prop">stacking order</a> of delegate instances is <code>1</code>.</p>
<p><b>Note: </b>Delegates are instantiated as needed and may be destroyed at any time. They are parented to <a href="qml-qtquick-listview.html">ListView</a>'s <a href="qml-qtquick-flickable.html#contentItem-prop">contentItem</a>, not to the view itself. State should <i>never</i> be stored in a delegate.</p><p><b>See also </b><a href="qml-qtquick-listview.html#stacking-order-in-listview">Stacking Order in ListView</a>.</p>
</div></div><!-- @@@delegate -->
<br/>
<!-- $$$displaced -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="displaced-prop">
<td class="tblQmlPropNode"><p>
<a name="displaced-prop"></a><span class="name">displaced</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the generic transition to apply to items that have been displaced by any model operation that affects the view.</p>
<p>This is a convenience for specifying the generic transition to be applied to any items that are displaced by an add, move or remove operation, without having to specify the individual <a href="qml-qtquick-listview.html#addDisplaced-prop">addDisplaced</a>, <a href="qml-qtquick-listview.html#moveDisplaced-prop">moveDisplaced</a> and <a href="qml-qtquick-listview.html#removeDisplaced-prop">removeDisplaced</a> properties. For example, here is a view that specifies a displaced transition:</p>
<pre class="cpp">

  ListView {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
      displaced: Transition {
          NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
      }
  }

</pre>
<p>When any item is added, moved or removed within the above view, the items below it are displaced, causing them to move down (or sideways, if horizontally orientated) within the view. As this displacement occurs, the items' movement to their new x,y positions within the view will be animated by a <a href="qml-qtquick-numberanimation.html">NumberAnimation</a> over one second, as specified.</p>
<p>If a view specifies this generic displaced transition as well as a specific <a href="qml-qtquick-listview.html#addDisplaced-prop">addDisplaced</a>, <a href="qml-qtquick-listview.html#moveDisplaced-prop">moveDisplaced</a> or <a href="qml-qtquick-listview.html#removeDisplaced-prop">removeDisplaced</a> transition, the more specific transition will be used instead of the generic displaced transition when the relevant operation occurs, providing that the more specific transition has not been disabled (by setting <a href="qml-qtquick-transition.html#enabled-prop">enabled</a> to false). If it has indeed been disabled, the generic displaced transition is applied instead.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#addDisplaced-prop">addDisplaced</a>, <a href="qml-qtquick-listview.html#moveDisplaced-prop">moveDisplaced</a>, <a href="qml-qtquick-listview.html#removeDisplaced-prop">removeDisplaced</a>, and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@displaced -->
<br/>
<!-- $$$displayMarginBeginning -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="displayMarginBeginning-prop">
<td class="tblQmlPropNode"><p>
<a name="displayMarginBeginning-prop"></a><span class="name">displayMarginBeginning</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property allows delegates to be displayed outside of the view geometry.</p>
<p>If this value is non-zero, the view will create extra delegates before the start of the view, or after the end. The view will create as many delegates as it can fit into the pixel size specified.</p>
<p>For example, if in a vertical view the delegate is 20 pixels high and <code>displayMarginBeginning</code> and <code>displayMarginEnd</code> are both set to 40, then 2 delegates above and 2 delegates below will be created and shown.</p>
<p>The default value is 0.</p>
<p>This property is meant for allowing certain UI configurations, and not as a performance optimization. If you wish to create delegates outside of the view geometry for performance reasons, you probably want to use the <a href="qml-qtquick-listview.html#cacheBuffer-prop">cacheBuffer</a> property instead.</p>
<p>This property was introduced in  QtQuick 2.3.</p>
</div></div><!-- @@@displayMarginBeginning -->
<br/>
<!-- $$$displayMarginEnd -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="displayMarginEnd-prop">
<td class="tblQmlPropNode"><p>
<a name="displayMarginEnd-prop"></a><span class="name">displayMarginEnd</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property allows delegates to be displayed outside of the view geometry.</p>
<p>If this value is non-zero, the view will create extra delegates before the start of the view, or after the end. The view will create as many delegates as it can fit into the pixel size specified.</p>
<p>For example, if in a vertical view the delegate is 20 pixels high and <code>displayMarginBeginning</code> and <code>displayMarginEnd</code> are both set to 40, then 2 delegates above and 2 delegates below will be created and shown.</p>
<p>The default value is 0.</p>
<p>This property is meant for allowing certain UI configurations, and not as a performance optimization. If you wish to create delegates outside of the view geometry for performance reasons, you probably want to use the <a href="qml-qtquick-listview.html#cacheBuffer-prop">cacheBuffer</a> property instead.</p>
<p>This property was introduced in  QtQuick 2.3.</p>
</div></div><!-- @@@displayMarginEnd -->
<br/>
<!-- $$$effectiveLayoutDirection -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="effectiveLayoutDirection-prop">
<td class="tblQmlPropNode"><p>
<a name="effectiveLayoutDirection-prop"></a><span class="name">effectiveLayoutDirection</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the effective layout direction of a horizontally-oriented list.</p>
<p>When using the attached property <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring::enabled</a> for locale layouts, the visual layout direction of the horizontal list will be mirrored. However, the property <a href="qml-qtquick-listview.html#layoutDirection-prop">layoutDirection</a> will remain unchanged.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#layoutDirection-prop">ListView::layoutDirection</a> and <a href="qml-qtquick-layoutmirroring.html">LayoutMirroring</a>.</p>
</div></div><!-- @@@effectiveLayoutDirection -->
<br/>
<!-- $$$footer -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="footer-prop">
<td class="tblQmlPropNode"><p>
<a name="footer-prop"></a><span class="name">footer</span> : <span class="type">Component</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the component to use as the footer.</p>
<p>An instance of the footer component is created for each view. The footer is positioned at the end of the view, after any items. The default <a href="qquickitem.html#z-prop">stacking order</a> of the footer is <code>1</code>.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#header-prop">header</a>, <a href="qml-qtquick-listview.html#footerItem-prop">footerItem</a>, and <a href="qml-qtquick-listview.html#stacking-order-in-listview">Stacking Order in ListView</a>.</p>
</div></div><!-- @@@footer -->
<br/>
<!-- $$$footerItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="footerItem-prop">
<td class="tblQmlPropNode"><p>
<a name="footerItem-prop"></a><span class="name">footerItem</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This holds the footer item created from the <a href="qml-qtquick-listview.html#footer-prop">footer</a> component.</p>
<p>An instance of the footer component is created for each view. The footer is positioned at the end of the view, after any items. The default <a href="qquickitem.html#z-prop">stacking order</a> of the footer is <code>1</code>.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#footer-prop">footer</a>, <a href="qml-qtquick-listview.html#headerItem-prop">headerItem</a>, and <a href="qml-qtquick-listview.html#stacking-order-in-listview">Stacking Order in ListView</a>.</p>
</div></div><!-- @@@footerItem -->
<br/>
<!-- $$$footerPositioning -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="footerPositioning-prop">
<td class="tblQmlPropNode"><p>
<a name="footerPositioning-prop"></a><span class="name">footerPositioning</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property determines the positioning of the <a href="qml-qtquick-listview.html#footerItem-prop">footer item</a>.</p>
<p>The possible values are:</p>
<ul>
<li><a href="qml-qtquick-listview.html">ListView</a>.InlineFooter (default) - the footer is positioned in the end of the content and moves together with the content like an ordinary item.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.OverlayFooter - the footer is positioned in the end of the view.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.PullBackFooter - the footer is positioned in the end of the view. The footer can be pushed away by moving the content backwards, and pulled back by moving the content forwards.</li>
</ul>
<p><b>Note: </b>This property has no effect on the <a href="qquickitem.html#z-prop">stacking order</a> of the footer. For example, if the footer should be shown above the <a href="qml-qtquick-listview.html#delegate-prop">delegate</a> items when using <code>ListView.OverlayFooter</code>, its Z value should be set to a value higher than that of the delegates. For more information, see <a href="qml-qtquick-listview.html#stacking-order-in-listview">Stacking Order in ListView</a>.</p><p>This property was introduced in  Qt 5.4.</p>
</div></div><!-- @@@footerPositioning -->
<br/>
<!-- $$$header -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="header-prop">
<td class="tblQmlPropNode"><p>
<a name="header-prop"></a><span class="name">header</span> : <span class="type">Component</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the component to use as the header.</p>
<p>An instance of the header component is created for each view. The header is positioned at the beginning of the view, before any items. The default <a href="qquickitem.html#z-prop">stacking order</a> of the header is <code>1</code>.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#footer-prop">footer</a>, <a href="qml-qtquick-listview.html#headerItem-prop">headerItem</a>, and <a href="qml-qtquick-listview.html#stacking-order-in-listview">Stacking Order in ListView</a>.</p>
</div></div><!-- @@@header -->
<br/>
<!-- $$$headerItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="headerItem-prop">
<td class="tblQmlPropNode"><p>
<a name="headerItem-prop"></a><span class="name">headerItem</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This holds the header item created from the <a href="qml-qtquick-listview.html#header-prop">header</a> component.</p>
<p>An instance of the header component is created for each view. The header is positioned at the beginning of the view, before any items. The default <a href="qquickitem.html#z-prop">stacking order</a> of the header is <code>1</code>.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#header-prop">header</a>, <a href="qml-qtquick-listview.html#footerItem-prop">footerItem</a>, and <a href="qml-qtquick-listview.html#stacking-order-in-listview">Stacking Order in ListView</a>.</p>
</div></div><!-- @@@headerItem -->
<br/>
<!-- $$$headerPositioning -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="headerPositioning-prop">
<td class="tblQmlPropNode"><p>
<a name="headerPositioning-prop"></a><span class="name">headerPositioning</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property determines the positioning of the <a href="qml-qtquick-listview.html#headerItem-prop">header item</a>.</p>
<p>The possible values are:</p>
<ul>
<li><a href="qml-qtquick-listview.html">ListView</a>.InlineHeader (default) - the header is positioned in the beginning of the content and moves together with the content like an ordinary item.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.OverlayHeader - the header is positioned in the beginning of the view.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.PullBackHeader - the header is positioned in the beginning of the view. The header can be pushed away by moving the content forwards, and pulled back by moving the content backwards.</li>
</ul>
<p><b>Note: </b>This property has no effect on the <a href="qquickitem.html#z-prop">stacking order</a> of the header. For example, if the header should be shown above the <a href="qml-qtquick-listview.html#delegate-prop">delegate</a> items when using <code>ListView.OverlayHeader</code>, its Z value should be set to a value higher than that of the delegates. For more information, see <a href="qml-qtquick-listview.html#stacking-order-in-listview">Stacking Order in ListView</a>.</p><p>This property was introduced in  Qt 5.4.</p>
</div></div><!-- @@@headerPositioning -->
<br/>
<!-- $$$highlight -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="highlight-prop">
<td class="tblQmlPropNode"><p>
<a name="highlight-prop"></a><span class="name">highlight</span> : <span class="type">Component</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the component to use as the highlight.</p>
<p>An instance of the highlight component is created for each list. The geometry of the resulting component instance is managed by the list so as to stay with the current item, unless the <a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> property is false. The default <a href="qquickitem.html#z-prop">stacking order</a> of the highlight item is <code>0</code>.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#highlightItem-prop">highlightItem</a>, <a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a>, <a href="qtquick-views-example.html#highlight">ListView highlight example</a>, and <a href="qml-qtquick-listview.html#stacking-order-in-listview">Stacking Order in ListView</a>.</p>
</div></div><!-- @@@highlight -->
<br/>
<!-- $$$highlightFollowsCurrentItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="highlightFollowsCurrentItem-prop">
<td class="tblQmlPropNode"><p>
<a name="highlightFollowsCurrentItem-prop"></a><span class="name">highlightFollowsCurrentItem</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds whether the highlight is managed by the view.</p>
<p>If this property is true (the default value), the highlight is moved smoothly to follow the current item. Otherwise, the highlight is not moved by the view, and any movement must be implemented by the highlight.</p>
<p>Here is a highlight with its motion defined by a <a href="qml-qtquick-springanimation.html">SpringAnimation</a> item:</p>
<pre class="qml">

  Component {
      id: highlight
      Rectangle {
          width: 180; height: 40
          color: "lightsteelblue"; radius: 5
          y: list.currentItem.y
          Behavior on y {
              SpringAnimation {
                  spring: 3
                  damping: 0.2
              }
          }
      }
  }

  ListView {
      id: list
      width: 180; height: 200
      model: ContactModel {}
      delegate: Text { text: name }

      highlight: highlight
      highlightFollowsCurrentItem: false
      focus: true
  }

</pre>
<p>Note that the highlight animation also affects the way that the view is scrolled. This is because the view moves to maintain the highlight within the preferred highlight range (or visible viewport).</p>
<p><b>See also </b><a href="qtquick-views-example.html#highlight">highlight</a> and <a href="qml-qtquick-listview.html#highlightMoveVelocity-prop">highlightMoveVelocity</a>.</p>
</div></div><!-- @@@highlightFollowsCurrentItem -->
<br/>
<!-- $$$highlightItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="highlightItem-prop">
<td class="tblQmlPropNode"><p>
<a name="highlightItem-prop"></a><span class="name">highlightItem</span> : <span class="type"><a href="qml-qtquick-item.html">Item</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This holds the highlight item created from the <a href="qtquick-views-example.html#highlight">highlight</a> component.</p>
<p>The <code>highlightItem</code> is managed by the view unless <a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> is set to false. The default <a href="qquickitem.html#z-prop">stacking order</a> of the highlight item is <code>0</code>.</p>
<p><b>See also </b><a href="qtquick-views-example.html#highlight">highlight</a>, <a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a>, and <a href="qml-qtquick-listview.html#stacking-order-in-listview">Stacking Order in ListView</a>.</p>
</div></div><!-- @@@highlightItem -->
<br/>
<!-- $$$highlightMoveDuration -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="highlightMoveDuration-prop">
<td class="tblQmlPropNode"><p>
<a name="highlightMoveDuration-prop"></a><span class="name">highlightMoveDuration</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties control the speed of the move and resize animations for the highlight delegate.</p>
<p><a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> must be true for these properties to have effect.</p>
<p>The default value for the velocity properties is 400 pixels/second. The default value for the duration properties is -1, i.e&#x2e; the highlight will take as much time as necessary to move at the set speed.</p>
<p>These properties have the same characteristics as a <a href="qml-qtquick-smoothedanimation.html">SmoothedAnimation</a>: if both the velocity and duration are set, the animation will use whichever gives the shorter duration.</p>
<p>The move velocity and duration properties are used to control movement due to index changes; for example, when <a href="qml-qtquick-listview.html#incrementCurrentIndex-method">incrementCurrentIndex()</a> is called. When the user flicks a <a href="qml-qtquick-listview.html">ListView</a>, the velocity from the flick is used to control the movement instead.</p>
<p>To set only one property, the other can be set to <code>-1</code>. For example, if you only want to animate the duration and not velocity, use the following code:</p>
<pre class="cpp">

  highlightMoveDuration: <span class="number">1000</span>
  highlightMoveVelocity: <span class="operator">-</span><span class="number">1</span>

</pre>
<p><b>See also </b><a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a>.</p>
</div></div><!-- @@@highlightMoveDuration -->
<br/>
<!-- $$$highlightMoveVelocity -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="highlightMoveVelocity-prop">
<td class="tblQmlPropNode"><p>
<a name="highlightMoveVelocity-prop"></a><span class="name">highlightMoveVelocity</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties control the speed of the move and resize animations for the highlight delegate.</p>
<p><a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> must be true for these properties to have effect.</p>
<p>The default value for the velocity properties is 400 pixels/second. The default value for the duration properties is -1, i.e&#x2e; the highlight will take as much time as necessary to move at the set speed.</p>
<p>These properties have the same characteristics as a <a href="qml-qtquick-smoothedanimation.html">SmoothedAnimation</a>: if both the velocity and duration are set, the animation will use whichever gives the shorter duration.</p>
<p>The move velocity and duration properties are used to control movement due to index changes; for example, when <a href="qml-qtquick-listview.html#incrementCurrentIndex-method">incrementCurrentIndex()</a> is called. When the user flicks a <a href="qml-qtquick-listview.html">ListView</a>, the velocity from the flick is used to control the movement instead.</p>
<p>To set only one property, the other can be set to <code>-1</code>. For example, if you only want to animate the duration and not velocity, use the following code:</p>
<pre class="cpp">

  highlightMoveDuration: <span class="number">1000</span>
  highlightMoveVelocity: <span class="operator">-</span><span class="number">1</span>

</pre>
<p><b>See also </b><a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a>.</p>
</div></div><!-- @@@highlightMoveVelocity -->
<br/>
<!-- $$$highlightRangeMode -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="highlightRangeMode-prop">
<td class="tblQmlPropNode"><p>
<a name="highlightRangeMode-prop"></a><span class="name">highlightRangeMode</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties define the preferred range of the highlight (for the current item) within the view. The <code>preferredHighlightBegin</code> value must be less than the <code>preferredHighlightEnd</code> value.</p>
<p>These properties affect the position of the current item when the list is scrolled. For example, if the currently selected item should stay in the middle of the list when the view is scrolled, set the <code>preferredHighlightBegin</code> and <code>preferredHighlightEnd</code> values to the top and bottom coordinates of where the middle item would be. If the <code>currentItem</code> is changed programmatically, the list will automatically scroll so that the current item is in the middle of the view. Furthermore, the behavior of the current item index will occur whether or not a highlight exists.</p>
<p>Valid values for <code>highlightRangeMode</code> are:</p>
<ul>
<li><a href="qml-qtquick-listview.html">ListView</a>.ApplyRange - the view attempts to maintain the highlight within the range. However, the highlight can move outside of the range at the ends of the list or due to mouse interaction.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.StrictlyEnforceRange - the highlight never moves outside of the range. The current item changes if a keyboard or mouse action would cause the highlight to move outside of the range.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.NoHighlightRange - this is the default value.</li>
</ul>
</div></div><!-- @@@highlightRangeMode -->
<br/>
<!-- $$$highlightResizeDuration -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="highlightResizeDuration-prop">
<td class="tblQmlPropNode"><p>
<a name="highlightResizeDuration-prop"></a><span class="name">highlightResizeDuration</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties control the speed of the move and resize animations for the highlight delegate.</p>
<p><a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> must be true for these properties to have effect.</p>
<p>The default value for the velocity properties is 400 pixels/second. The default value for the duration properties is -1, i.e&#x2e; the highlight will take as much time as necessary to move at the set speed.</p>
<p>These properties have the same characteristics as a <a href="qml-qtquick-smoothedanimation.html">SmoothedAnimation</a>: if both the velocity and duration are set, the animation will use whichever gives the shorter duration.</p>
<p>The move velocity and duration properties are used to control movement due to index changes; for example, when <a href="qml-qtquick-listview.html#incrementCurrentIndex-method">incrementCurrentIndex()</a> is called. When the user flicks a <a href="qml-qtquick-listview.html">ListView</a>, the velocity from the flick is used to control the movement instead.</p>
<p>To set only one property, the other can be set to <code>-1</code>. For example, if you only want to animate the duration and not velocity, use the following code:</p>
<pre class="cpp">

  highlightMoveDuration: <span class="number">1000</span>
  highlightMoveVelocity: <span class="operator">-</span><span class="number">1</span>

</pre>
<p><b>See also </b><a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a>.</p>
</div></div><!-- @@@highlightResizeDuration -->
<br/>
<!-- $$$highlightResizeVelocity -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="highlightResizeVelocity-prop">
<td class="tblQmlPropNode"><p>
<a name="highlightResizeVelocity-prop"></a><span class="name">highlightResizeVelocity</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties control the speed of the move and resize animations for the highlight delegate.</p>
<p><a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a> must be true for these properties to have effect.</p>
<p>The default value for the velocity properties is 400 pixels/second. The default value for the duration properties is -1, i.e&#x2e; the highlight will take as much time as necessary to move at the set speed.</p>
<p>These properties have the same characteristics as a <a href="qml-qtquick-smoothedanimation.html">SmoothedAnimation</a>: if both the velocity and duration are set, the animation will use whichever gives the shorter duration.</p>
<p>The move velocity and duration properties are used to control movement due to index changes; for example, when <a href="qml-qtquick-listview.html#incrementCurrentIndex-method">incrementCurrentIndex()</a> is called. When the user flicks a <a href="qml-qtquick-listview.html">ListView</a>, the velocity from the flick is used to control the movement instead.</p>
<p>To set only one property, the other can be set to <code>-1</code>. For example, if you only want to animate the duration and not velocity, use the following code:</p>
<pre class="cpp">

  highlightMoveDuration: <span class="number">1000</span>
  highlightMoveVelocity: <span class="operator">-</span><span class="number">1</span>

</pre>
<p><b>See also </b><a href="qml-qtquick-listview.html#highlightFollowsCurrentItem-prop">highlightFollowsCurrentItem</a>.</p>
</div></div><!-- @@@highlightResizeVelocity -->
<br/>
<!-- $$$keyNavigationEnabled -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="keyNavigationEnabled-prop">
<td class="tblQmlPropNode"><p>
<a name="keyNavigationEnabled-prop"></a><span class="name">keyNavigationEnabled</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds whether the key navigation of the list is enabled.</p>
<p>If this is <code>true</code>, the user can navigate the view with a keyboard. It is useful for applications that need to selectively enable or disable mouse and keyboard interaction.</p>
<p>By default, the value of this property is bound to <a href="qml-qtquick-flickable.html#interactive-prop">interactive</a> to ensure behavior compatibility for existing applications. When explicitly set, it will cease to be bound to the interactive property.</p>
<p>This property was introduced in  Qt 5.7.</p>
<p><b>See also </b><a href="qml-qtquick-flickable.html#interactive-prop">interactive</a>.</p>
</div></div><!-- @@@keyNavigationEnabled -->
<br/>
<!-- $$$keyNavigationWraps -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="keyNavigationWraps-prop">
<td class="tblQmlPropNode"><p>
<a name="keyNavigationWraps-prop"></a><span class="name">keyNavigationWraps</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds whether the list wraps key navigation.</p>
<p>If this is true, key navigation that would move the current item selection past the end of the list instead wraps around and moves the selection to the start of the list, and vice-versa.</p>
<p>By default, key navigation is not wrapped.</p>
</div></div><!-- @@@keyNavigationWraps -->
<br/>
<!-- $$$layoutDirection -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="layoutDirection-prop">
<td class="tblQmlPropNode"><p>
<a name="layoutDirection-prop"></a><span class="name">layoutDirection</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the layout direction of a horizontally-oriented list.</p>
<p>Possible values:</p>
<ul>
<li>Qt.LeftToRight (default) - Items will be laid out from left to right.</li>
<li>Qt.RightToLeft - Items will be laid out from right to let.</li>
</ul>
<p>Setting this property has no effect if the <a href="qml-qtquick-listview.html#orientation-prop">orientation</a> is Qt.Vertical.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#effectiveLayoutDirection-prop">ListView::effectiveLayoutDirection</a> and <a href="qml-qtquick-listview.html#verticalLayoutDirection-prop">ListView::verticalLayoutDirection</a>.</p>
</div></div><!-- @@@layoutDirection -->
<br/>
<!-- $$$model -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="model-prop">
<td class="tblQmlPropNode"><p>
<a name="model-prop"></a><span class="name">model</span> : <span class="type">model</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the model providing data for the list.</p>
<p>The model provides the set of data that is used to create the items in the view. Models can be created directly in QML using ListModel, XmlListModel or <a href="qtquick-views-example.html#objectmodel">ObjectModel</a>, or provided by C++ model classes. If a C++ model class is used, it must be a subclass of QAbstractItemModel or a simple list.</p>
<p><b>See also </b><a href="qtquick-modelviewsdata-modelview.html#qml-data-models">Data Models</a>.</p>
</div></div><!-- @@@model -->
<br/>
<!-- $$$move -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="move-prop">
<td class="tblQmlPropNode"><p>
<a name="move-prop"></a><span class="name">move</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition to apply to items in the view that are being moved due to a move operation in the view's <a href="qml-qtquick-listview.html#model-prop">model</a>.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">

  ListView {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
      move: Transition {
          NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
      }
  }

</pre>
<p>Whenever the <a href="qml-qtquick-listview.html#model-prop">model</a> performs a move operation to move a particular set of indexes, the respective items in the view will be animated to their new positions in the view over one second. The transition only applies to the items that are the subject of the move operation in the model; it does not apply to items below them that are displaced by the move operation. To animate the displaced items, set the <a href="qml-qtquick-listview.html#displaced-prop">displaced</a> or <a href="qml-qtquick-listview.html#moveDisplaced-prop">moveDisplaced</a> properties.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#moveDisplaced-prop">moveDisplaced</a> and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@move -->
<br/>
<!-- $$$moveDisplaced -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="moveDisplaced-prop">
<td class="tblQmlPropNode"><p>
<a name="moveDisplaced-prop"></a><span class="name">moveDisplaced</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition to apply to items that are displaced by a move operation in the view's <a href="qml-qtquick-listview.html#model-prop">model</a>.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">

  ListView {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
      moveDisplaced: Transition {
          NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
      }
  }

</pre>
<p>Whenever the <a href="qml-qtquick-listview.html#model-prop">model</a> performs a move operation to move a particular set of indexes, the items between the source and destination indexes of the move operation are displaced, causing them to move upwards or downwards (or sideways, if horizontally orientated) within the view. As this displacement occurs, the items' movement to their new x,y positions within the view will be animated by a <a href="qml-qtquick-numberanimation.html">NumberAnimation</a> over one second, as specified. This transition is not applied to the items that are the actual subjects of the move operation; to animate the moved items, set the <a href="qml-qtquick-listview.html#move-prop">move</a> property.</p>
<p>If an item is displaced by multiple types of operations at the same time, it is not defined as to whether the <a href="qml-qtquick-listview.html#addDisplaced-prop">addDisplaced</a>, moveDisplaced or <a href="qml-qtquick-listview.html#removeDisplaced-prop">removeDisplaced</a> transition will be applied. Additionally, if it is not necessary to specify different transitions depending on whether an item is displaced by an add, move or remove operation, consider setting the <a href="qml-qtquick-listview.html#displaced-prop">displaced</a> property instead.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#displaced-prop">displaced</a>, <a href="qml-qtquick-listview.html#move-prop">move</a>, and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@moveDisplaced -->
<br/>
<!-- $$$orientation -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="orientation-prop">
<td class="tblQmlPropNode"><p>
<a name="orientation-prop"></a><span class="name">orientation</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the orientation of the list.</p>
<p>Possible values:</p>
<ul>
<li><a href="qml-qtquick-listview.html">ListView</a>.Horizontal - Items are laid out horizontally</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.Vertical (default) - Items are laid out vertically</li>
</ul>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td >Horizontal orientation:<p class="centerAlign"><img src="images/ListViewHorizontal.png" alt="" /></p></td></tr>
<tr valign="top" class="even"><td >Vertical orientation:<p class="centerAlign"><img src="images/listview-highlight.png" alt="" /></p></td></tr>
</table></div>
<p><b>See also </b><a href="qml-qtquick-listview.html#flickable-direction">Flickable Direction</a>.</p>
</div></div><!-- @@@orientation -->
<br/>
<!-- $$$populate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="populate-prop">
<td class="tblQmlPropNode"><p>
<a name="populate-prop"></a><span class="name">populate</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition to apply to the items that are initially created for a view.</p>
<p>It is applied to all items that are created when:</p>
<ul>
<li>The view is first created</li>
<li>The view's <a href="qml-qtquick-listview.html#model-prop">model</a> changes in such a way that the visible delegates are completely replaced</li>
<li>The view's <a href="qml-qtquick-listview.html#model-prop">model</a> is reset, if the model is a QAbstractItemModel subclass</li>
</ul>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">

  ListView {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
      populate: Transition {
          NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
      }
  }

</pre>
<p>When the view is initialized, the view will create all the necessary items for the view, then animate them to their correct positions within the view over one second.</p>
<p>However when scrolling the view later, the populate transition does not run, even though delegates are being instantiated as they become visible. When the model changes in a way that new delegates become visible, the <a href="qml-qtquick-listview.html#add-prop">add</a> transition is the one that runs. So you should not depend on the <code>populate</code> transition to initialize properties in the delegate, because it does not apply to every delegate. If your animation sets the <code>to</code> value of a property, the property should initially have the <code>to</code> value, and the animation should set the <code>from</code> value in case it is animated:</p>
<pre class="cpp">

  ListView {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
      delegate: Rectangle {
          opacity: <span class="number">1</span> <span class="comment">// not necessary because it's the default</span>
      }
      populate: Transition {
          NumberAnimation { property: <span class="string">&quot;opacity&quot;</span>; from: <span class="number">0</span>; to: <span class="number">1</span>; duration: <span class="number">1000</span> }
      }
  }

</pre>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#add-prop">add</a> and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@populate -->
<br/>
<!-- $$$preferredHighlightBegin -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="preferredHighlightBegin-prop">
<td class="tblQmlPropNode"><p>
<a name="preferredHighlightBegin-prop"></a><span class="name">preferredHighlightBegin</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties define the preferred range of the highlight (for the current item) within the view. The <code>preferredHighlightBegin</code> value must be less than the <code>preferredHighlightEnd</code> value.</p>
<p>These properties affect the position of the current item when the list is scrolled. For example, if the currently selected item should stay in the middle of the list when the view is scrolled, set the <code>preferredHighlightBegin</code> and <code>preferredHighlightEnd</code> values to the top and bottom coordinates of where the middle item would be. If the <code>currentItem</code> is changed programmatically, the list will automatically scroll so that the current item is in the middle of the view. Furthermore, the behavior of the current item index will occur whether or not a highlight exists.</p>
<p>Valid values for <code>highlightRangeMode</code> are:</p>
<ul>
<li><a href="qml-qtquick-listview.html">ListView</a>.ApplyRange - the view attempts to maintain the highlight within the range. However, the highlight can move outside of the range at the ends of the list or due to mouse interaction.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.StrictlyEnforceRange - the highlight never moves outside of the range. The current item changes if a keyboard or mouse action would cause the highlight to move outside of the range.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.NoHighlightRange - this is the default value.</li>
</ul>
</div></div><!-- @@@preferredHighlightBegin -->
<br/>
<!-- $$$preferredHighlightEnd -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="preferredHighlightEnd-prop">
<td class="tblQmlPropNode"><p>
<a name="preferredHighlightEnd-prop"></a><span class="name">preferredHighlightEnd</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties define the preferred range of the highlight (for the current item) within the view. The <code>preferredHighlightBegin</code> value must be less than the <code>preferredHighlightEnd</code> value.</p>
<p>These properties affect the position of the current item when the list is scrolled. For example, if the currently selected item should stay in the middle of the list when the view is scrolled, set the <code>preferredHighlightBegin</code> and <code>preferredHighlightEnd</code> values to the top and bottom coordinates of where the middle item would be. If the <code>currentItem</code> is changed programmatically, the list will automatically scroll so that the current item is in the middle of the view. Furthermore, the behavior of the current item index will occur whether or not a highlight exists.</p>
<p>Valid values for <code>highlightRangeMode</code> are:</p>
<ul>
<li><a href="qml-qtquick-listview.html">ListView</a>.ApplyRange - the view attempts to maintain the highlight within the range. However, the highlight can move outside of the range at the ends of the list or due to mouse interaction.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.StrictlyEnforceRange - the highlight never moves outside of the range. The current item changes if a keyboard or mouse action would cause the highlight to move outside of the range.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.NoHighlightRange - this is the default value.</li>
</ul>
</div></div><!-- @@@preferredHighlightEnd -->
<br/>
<!-- $$$remove -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="remove-prop">
<td class="tblQmlPropNode"><p>
<a name="remove-prop"></a><span class="name">remove</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition to apply to items that are removed from the view.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">

  ListView {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
      remove: Transition {
          ParallelAnimation {
              NumberAnimation { property: <span class="string">&quot;opacity&quot;</span>; to: <span class="number">0</span>; duration: <span class="number">1000</span> }
              NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; to: <span class="number">100</span>; duration: <span class="number">1000</span> }
          }
      }
  }

</pre>
<p>Whenever an item is removed from the above view, the item will be animated to the position (100,100) over one second, and in parallel will also change its opacity to 0. The transition only applies to the items that are removed from the view; it does not apply to the items below them that are displaced by the removal of the items. To animate the displaced items, set the <a href="qml-qtquick-listview.html#displaced-prop">displaced</a> or <a href="qml-qtquick-listview.html#removeDisplaced-prop">removeDisplaced</a> properties.</p>
<p>Note that by the time the transition is applied, the item has already been removed from the model; any references to the model data for the removed index will not be valid.</p>
<p>Additionally, if the <a href="qml-qtquick-listview.html#delayRemove-attached-prop">delayRemove</a> attached property has been set for a delegate item, the remove transition will not be applied until <a href="qml-qtquick-listview.html#delayRemove-attached-prop">delayRemove</a> becomes false again.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#removeDisplaced-prop">removeDisplaced</a> and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@remove -->
<br/>
<!-- $$$removeDisplaced -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="removeDisplaced-prop">
<td class="tblQmlPropNode"><p>
<a name="removeDisplaced-prop"></a><span class="name">removeDisplaced</span> : <span class="type"><a href="qml-qtquick-transition.html">Transition</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the transition to apply to items in the view that are displaced by the removal of other items in the view.</p>
<p>For example, here is a view that specifies such a transition:</p>
<pre class="cpp">

  ListView {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
      removeDisplaced: Transition {
          NumberAnimation { properties: <span class="string">&quot;x,y&quot;</span>; duration: <span class="number">1000</span> }
      }
  }

</pre>
<p>Whenever an item is removed from the above view, all items beneath it are displaced, causing them to move upwards (or sideways, if horizontally orientated) within the view. As this displacement occurs, the items' movement to their new x,y positions within the view will be animated by a <a href="qml-qtquick-numberanimation.html">NumberAnimation</a> over one second, as specified. This transition is not applied to the item that has actually been removed from the view; to animate the removed items, set the <a href="qml-qtquick-listview.html#remove-prop">remove</a> property.</p>
<p>If an item is displaced by multiple types of operations at the same time, it is not defined as to whether the <a href="qml-qtquick-listview.html#addDisplaced-prop">addDisplaced</a>, <a href="qml-qtquick-listview.html#moveDisplaced-prop">moveDisplaced</a> or removeDisplaced transition will be applied. Additionally, if it is not necessary to specify different transitions depending on whether an item is displaced by an add, move or remove operation, consider setting the <a href="qml-qtquick-listview.html#displaced-prop">displaced</a> property instead.</p>
<p>For more details and examples on how to use view transitions, see the <a href="qml-qtquick-viewtransition.html">ViewTransition</a> documentation.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#displaced-prop">displaced</a>, <a href="qml-qtquick-listview.html#remove-prop">remove</a>, and <a href="qml-qtquick-viewtransition.html">ViewTransition</a>.</p>
</div></div><!-- @@@removeDisplaced -->
<br/>
<!-- $$$section -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="even" id="section-prop"><th class="centerAlign"><p><a name="section-prop"></a><b>section group</b></p></th></tr><tr valign="top" class="odd" id="section.property-prop"><td class="tblQmlPropNode"><p><a name="section.property-prop"></a><span class="name">section.property</span> : <span class="type">string</span></p></td></tr><tr valign="top" class="odd" id="section.criteria-prop"><td class="tblQmlPropNode"><p><a name="section.criteria-prop"></a><span class="name">section.criteria</span> : <span class="type">enumeration</span></p></td></tr><tr valign="top" class="odd" id="section.delegate-prop"><td class="tblQmlPropNode"><p><a name="section.delegate-prop"></a><span class="name">section.delegate</span> : <span class="type">Component</span></p></td></tr><tr valign="top" class="odd" id="section.labelPositioning-prop"><td class="tblQmlPropNode"><p><a name="section.labelPositioning-prop"></a><span class="name">section.labelPositioning</span> : <span class="type">enumeration</span></p></td></tr></table></div></div><div class="qmldoc"><p>These properties determine the expression to be evaluated and appearance of the section labels.</p>
<p><code>section.property</code> holds the name of the property that is the basis of each section.</p>
<p><code>section.criteria</code> holds the criteria for forming each section based on <code>section.property</code>. This value can be one of:</p>
<ul>
<li>ViewSection.FullString (default) - sections are created based on the <code>section.property</code> value.</li>
<li>ViewSection.FirstCharacter - sections are created based on the first character of the <code>section.property</code> value (for example, 'A', 'B', 'C' sections, etc. for an address book)</li>
</ul>
<p>A case insensitive comparison is used when determining section boundaries.</p>
<p><code>section.delegate</code> holds the delegate component for each section. The default <a href="qquickitem.html#z-prop">stacking order</a> of section delegate instances is <code>2</code>.</p>
<p><code>section.labelPositioning</code> determines whether the current and/or next section labels stick to the start/end of the view, and whether the labels are shown inline. This value can be a combination of:</p>
<ul>
<li>ViewSection.InlineLabels - section labels are shown inline between the item delegates separating sections (default).</li>
<li>ViewSection.CurrentLabelAtStart - the current section label sticks to the start of the view as it is moved.</li>
<li>ViewSection.NextLabelAtEnd - the next section label (beyond all visible sections) sticks to the end of the view as it is moved.<p><b>Note: </b>Enabling <code>ViewSection.NextLabelAtEnd</code> requires the view to scan ahead for the next section, which has performance implications, especially for slower models.</p></li>
</ul>
<p>Each item in the list has attached properties named <code>ListView.section</code>, <code>ListView.previousSection</code> and <code>ListView.nextSection</code>.</p>
<p>For example, here is a <a href="qml-qtquick-listview.html">ListView</a> that displays a list of animals, separated into sections. Each item in the <a href="qml-qtquick-listview.html">ListView</a> is placed in a different section depending on the &quot;size&quot; property of the model item. The <code>sectionHeading</code> delegate component provides the light blue bar that marks the beginning of each section.</p>
<pre class="qml">

      // The delegate for each section header
      Component {
          id: sectionHeading
          Rectangle {
              width: container.width
              height: childrenRect.height
              color: "lightsteelblue"

              Text {
                  text: section
                  font.bold: true
                  font.pixelSize: 20
              }
          }
      }

      ListView {
          id: view
          anchors.top: parent.top
          anchors.bottom: buttonBar.top
          width: parent.width
          model: animalsModel
          delegate: Text { text: name; font.pixelSize: 18 }

          section.property: "size"
          section.criteria: ViewSection.FullString
          section.delegate: sectionHeading
      }

</pre>
<p class="centerAlign"><img src="images/qml-listview-sections-example.png" alt="" /></p><p><b>Note: </b>Adding sections to a <a href="qml-qtquick-listview.html">ListView</a> does not automatically re-order the list items by the section criteria. If the model is not ordered by section, then it is possible that the sections created will not be unique; each boundary between differing sections will result in a section header being created even if that section exists elsewhere.</p><p><b>See also </b><a href="qtquick-views-example.html">ListView examples</a> and <a href="qml-qtquick-listview.html#stacking-order-in-listview">Stacking Order in ListView</a>.</p>
</div></div><!-- @@@section -->
<br/>
<!-- $$$snapMode -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="snapMode-prop">
<td class="tblQmlPropNode"><p>
<a name="snapMode-prop"></a><span class="name">snapMode</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property determines how the view scrolling will settle following a drag or flick. The possible values are:</p>
<ul>
<li><a href="qml-qtquick-listview.html">ListView</a>.NoSnap (default) - the view stops anywhere within the visible area.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.SnapToItem - the view settles with an item aligned with the start of the view.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.SnapOneItem - the view settles no more than one item away from the first visible item at the time the mouse button is released. This mode is particularly useful for moving one page at a time. When SnapOneItem is enabled, the <a href="qml-qtquick-listview.html">ListView</a> will show a stronger affinity to neighboring items when movement occurs. For example, a short drag that snaps back to the current item with SnapToItem might snap to a neighboring item with SnapOneItem.</li>
</ul>
<p><code>snapMode</code> does not affect the <a href="qml-qtquick-listview.html#currentIndex-prop">currentIndex</a>. To update the <a href="qml-qtquick-listview.html#currentIndex-prop">currentIndex</a> as the list is moved, set <a href="qml-qtquick-listview.html#highlightRangeMode-prop">highlightRangeMode</a> to <code>ListView.StrictlyEnforceRange</code>.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#highlightRangeMode-prop">highlightRangeMode</a>.</p>
</div></div><!-- @@@snapMode -->
<br/>
<!-- $$$spacing -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="spacing-prop">
<td class="tblQmlPropNode"><p>
<a name="spacing-prop"></a><span class="name">spacing</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the spacing between items.</p>
<p>The default value is 0.</p>
</div></div><!-- @@@spacing -->
<br/>
<!-- $$$verticalLayoutDirection -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="verticalLayoutDirection-prop">
<td class="tblQmlPropNode"><p>
<a name="verticalLayoutDirection-prop"></a><span class="name">verticalLayoutDirection</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the layout direction of a vertically-oriented list.</p>
<p>Possible values:</p>
<ul>
<li><a href="qml-qtquick-listview.html">ListView</a>.TopToBottom (default) - Items are laid out from the top of the view down to the bottom of the view.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.BottomToTop - Items are laid out from the bottom of the view up to the top of the view.</li>
</ul>
<p>Setting this property has no effect if the <a href="qml-qtquick-listview.html#orientation-prop">orientation</a> is Qt.Horizontal.</p>
<p><b>See also </b><a href="qml-qtquick-listview.html#layoutDirection-prop">ListView::layoutDirection</a>.</p>
</div></div><!-- @@@verticalLayoutDirection -->
<br/>
<h2>Attached Property Documentation</h2>
<!-- $$$delayRemove -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="delayRemove-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="delayRemove-attached-prop"></a><span class="name">ListView.delayRemove</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds whether the delegate may be destroyed. It is attached to each instance of the delegate. The default value is false.</p>
<p>It is sometimes necessary to delay the destruction of an item until an animation completes. The example delegate below ensures that the animation completes before the item is removed from the list.</p>
<pre class="qml">

  Component {
      id: delegate
      Item {
          ListView.onRemove: SequentialAnimation {
              PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
              NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: Easing.InOutQuad }
              PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
          }
      }
  }

</pre>
<p>If a <a href="qml-qtquick-listview.html#remove-prop">remove</a> transition has been specified, it will not be applied until delayRemove is returned to <code>false</code>.</p>
</div></div><!-- @@@delayRemove -->
<br/>
<!-- $$$isCurrentItem -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="isCurrentItem-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="isCurrentItem-attached-prop"></a><span class="name">ListView.isCurrentItem</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property is true if this delegate is the current item; otherwise false.</p>
<p>It is attached to each instance of the delegate.</p>
<p>This property may be used to adjust the appearance of the current item, for example:</p>
<pre class="qml">

  ListView {
      width: 180; height: 200

      Component {
          id: contactsDelegate
          Rectangle {
              id: wrapper
              width: 180
              height: contactInfo.height
              color: ListView.isCurrentItem ? "black" : "red"
              Text {
                  id: contactInfo
                  text: name + ": " + number
                  color: wrapper.ListView.isCurrentItem ? "red" : "black"
              }
          }
      }

      model: ContactModel {}
      delegate: contactsDelegate
      focus: true
  }

</pre>
</div></div><!-- @@@isCurrentItem -->
<br/>
<!-- $$$nextSection -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="nextSection-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="nextSection-attached-prop"></a><span class="name">ListView.nextSection</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the section of the next element.</p>
<p>It is attached to each instance of the delegate.</p>
<p>The section is evaluated using the <a href="qml-qtquick-listview.html#section.property-prop">section</a> properties.</p>
</div></div><!-- @@@nextSection -->
<br/>
<!-- $$$previousSection -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="previousSection-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="previousSection-attached-prop"></a><span class="name">ListView.previousSection</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the section of the previous element.</p>
<p>It is attached to each instance of the delegate.</p>
<p>The section is evaluated using the <a href="qml-qtquick-listview.html#section.property-prop">section</a> properties.</p>
</div></div><!-- @@@previousSection -->
<br/>
<!-- $$$section -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="section-attached-prop">
<td class="tblQmlPropNode"><p>
<a name="section-attached-prop"></a><span class="name">ListView.section</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the section of this element.</p>
<p>It is attached to each instance of the delegate.</p>
<p>The section is evaluated using the <a href="qml-qtquick-listview.html#section.property-prop">section</a> properties.</p>
</div></div><!-- @@@section -->
<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="name">ListView.view</span> : <span class="type"><a href="qml-qtquick-listview.html">ListView</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached property holds the view that manages this delegate instance.</p>
<p>It is attached to each instance of the delegate and also to the header, the footer, the section and the highlight delegates.</p>
</div></div><!-- @@@view -->
<br/>
<h2>Attached Signal Documentation</h2>
<!-- $$$add -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="add-signal">
<td class="tblQmlFuncNode"><p>
<a name="add-signal"></a><span class="name">add</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached signal is emitted immediately after an item is added to the view.</p>
<p>If an <a href="qml-qtquick-listview.html#add-prop">add</a> transition is specified, it is applied immediately after this signal is handled.</p>
<p>The corresponding handler is <code>onAdd</code>.</p>
</div></div><!-- @@@add -->
<br/>
<!-- $$$remove -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="remove-signal">
<td class="tblQmlFuncNode"><p>
<a name="remove-signal"></a><span class="name">remove</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This attached signal is emitted immediately before an item is removed from the view.</p>
<p>If a <a href="qml-qtquick-listview.html#remove-prop">remove</a> transition has been specified, it is applied after this signal is handled, providing that <a href="qml-qtquick-listview.html#delayRemove-attached-prop">delayRemove</a> is false.</p>
<p>The corresponding handler is <code>onRemove</code>.</p>
</div></div><!-- @@@remove -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$ -->
<div class="qmlitem"><div class="fngroup">
<div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="positionViewAtBeginning-method"></a><span class="name">positionViewAtBeginning</span>()</p></td></tr>
<tr valign="top" class="odd" id="">
<td class="tblQmlFuncNode"><p>
<a name="positionViewAtEnd-method"></a><span class="name">positionViewAtEnd</span>()</p></td></tr>
</table></div>
</div></div><div class="qmldoc"><p>Positions the view at the beginning or end, taking into account any header or footer.</p>
<p>It is not recommended to use <a href="qml-qtquick-flickable.html#contentX-prop">contentX</a> or <a href="qml-qtquick-flickable.html#contentY-prop">contentY</a> to position the view at a particular index. This is unreliable since removing items from the start of the list does not cause all other items to be repositioned, and because the actual start of the view can vary based on the size of the delegates.</p>
<p><b>Note</b>: methods should only be called after the Component has completed. To position the view at startup, this method should be called by Component.onCompleted. For example, to position the view at the end on startup:</p>
<pre class="cpp">

  Component<span class="operator">.</span>onCompleted: positionViewAtEnd()

</pre>
</div></div><!-- @@@ -->
<br/>
<!-- $$$decrementCurrentIndex -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="decrementCurrentIndex-method">
<td class="tblQmlFuncNode"><p>
<a name="decrementCurrentIndex-method"></a><span class="name">decrementCurrentIndex</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Decrements the current index. The current index will wrap if <a href="qml-qtquick-listview.html#keyNavigationWraps-prop">keyNavigationWraps</a> is true and it is currently at the beginning. This method has no effect if the <a href="qml-qtquick-listview.html#count-prop">count</a> is zero.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
</div></div><!-- @@@decrementCurrentIndex -->
<br/>
<!-- $$$forceLayout -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="forceLayout-method">
<td class="tblQmlFuncNode"><p>
<a name="forceLayout-method"></a><span class="name">forceLayout</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Responding to changes in the model is usually batched to happen only once per frame. This means that inside script blocks it is possible for the underlying model to have changed, but the <a href="qml-qtquick-listview.html">ListView</a> has not caught up yet.</p>
<p>This method forces the <a href="qml-qtquick-listview.html">ListView</a> to immediately respond to any outstanding changes in the model.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
<p>This method was introduced in  Qt 5.1.</p>
</div></div><!-- @@@forceLayout -->
<br/>
<!-- $$$incrementCurrentIndex -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="incrementCurrentIndex-method">
<td class="tblQmlFuncNode"><p>
<a name="incrementCurrentIndex-method"></a><span class="name">incrementCurrentIndex</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Increments the current index. The current index will wrap if <a href="qml-qtquick-listview.html#keyNavigationWraps-prop">keyNavigationWraps</a> is true and it is currently at the end. This method has no effect if the <a href="qml-qtquick-listview.html#count-prop">count</a> is zero.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
</div></div><!-- @@@incrementCurrentIndex -->
<br/>
<!-- $$$indexAt -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="indexAt-method">
<td class="tblQmlFuncNode"><p>
<a name="indexAt-method"></a><span class="type">int</span> <span class="name">indexAt</span>(<span class="type">real</span> <i>x</i>,  <span class="type">real</span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the index of the visible item containing the point <i>x</i>, <i>y</i> in content coordinates. If there is no item at the point specified, or the item is not visible -1 is returned.</p>
<p>If the item is outside the visible area, -1 is returned, regardless of whether an item will exist at that point when scrolled into view.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
</div></div><!-- @@@indexAt -->
<br/>
<!-- $$$itemAt -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="itemAt-method">
<td class="tblQmlFuncNode"><p>
<a name="itemAt-method"></a><span class="type"><a href="qml-qtquick-item.html">Item</a></span> <span class="name">itemAt</span>(<span class="type">real</span> <i>x</i>,  <span class="type">real</span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the visible item containing the point <i>x</i>, <i>y</i> in content coordinates. If there is no item at the point specified, or the item is not visible null is returned.</p>
<p>If the item is outside the visible area, null is returned, regardless of whether an item will exist at that point when scrolled into view.</p>
<p><b>Note</b>: methods should only be called after the Component has completed.</p>
</div></div><!-- @@@itemAt -->
<br/>
<!-- $$$positionViewAtIndex -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="positionViewAtIndex-method">
<td class="tblQmlFuncNode"><p>
<a name="positionViewAtIndex-method"></a><span class="name">positionViewAtIndex</span>(<span class="type">int</span> <i>index</i>,  <span class="type">PositionMode</span> <i>mode</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Positions the view such that the <i>index</i> is at the position specified by <i>mode</i>:</p>
<ul>
<li><a href="qml-qtquick-listview.html">ListView</a>.Beginning - position item at the top (or left for horizontal orientation) of the view.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.Center - position item in the center of the view.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.End - position item at bottom (or right for horizontal orientation) of the view.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.Visible - if any part of the item is visible then take no action, otherwise bring the item into view.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.Contain - ensure the entire item is visible. If the item is larger than the view the item is positioned at the top (or left for horizontal orientation) of the view.</li>
<li><a href="qml-qtquick-listview.html">ListView</a>.SnapPosition - position the item at <a href="qml-qtquick-listview.html#preferredHighlightBegin-prop">preferredHighlightBegin</a>. This mode is only valid if <a href="qml-qtquick-listview.html#highlightRangeMode-prop">highlightRangeMode</a> is StrictlyEnforceRange or snapping is enabled via <a href="qml-qtquick-listview.html#snapMode-prop">snapMode</a>.</li>
</ul>
<p>If positioning the view at <i>index</i> would cause empty space to be displayed at the beginning or end of the view, the view will be positioned at the boundary.</p>
<p>It is not recommended to use <a href="qml-qtquick-flickable.html#contentX-prop">contentX</a> or <a href="qml-qtquick-flickable.html#contentY-prop">contentY</a> to position the view at a particular index. This is unreliable since removing items from the start of the list does not cause all other items to be repositioned, and because the actual start of the view can vary based on the size of the delegates. The correct way to bring an item into view is with <code>positionViewAtIndex</code>.</p>
<p><b>Note</b>: methods should only be called after the Component has completed. To position the view at startup, this method should be called by Component.onCompleted. For example, to position the view at the end:</p>
<pre class="cpp">

  Component<span class="operator">.</span>onCompleted: positionViewAtIndex(count <span class="operator">-</span> <span class="number">1</span><span class="operator">,</span> ListView<span class="operator">.</span>Beginning)

</pre>
</div></div><!-- @@@positionViewAtIndex -->
<br/>
        </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>