<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ListView is not showing currentIndex]]></title><description><![CDATA[<p dir="auto">Hi!<br />
When scrolling, the listView does not show the currentIndex. currentIndex is always 0. How to get correct currentIndex?</p>
<pre><code>    ListView{
        id: listView1
        anchors.bottom: rectangleDown.top
        anchors.bottomMargin: 15
        anchors.top: rectangleTop.bottom
        anchors.topMargin: 0
        anchors.right: rectangleTop.right
        anchors.rightMargin: 0
        anchors.left: rectangleTop.left
        anchors.leftMargin: 0
        clip: true
        snapMode: ListView.SnapToItem

        model: ListModel
        {
            id: listModel1
        }
</code></pre>
]]></description><link>https://forum.qt.io/topic/107087/listview-is-not-showing-currentindex</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 13:54:51 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/107087.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 21 Sep 2019 12:03:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ListView is not showing currentIndex on Mon, 23 Sep 2019 14:42:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mihaill">@<bdi>Mihaill</bdi></a> np</p>
]]></description><link>https://forum.qt.io/post/552453</link><guid isPermaLink="true">https://forum.qt.io/post/552453</guid><dc:creator><![CDATA[ODБOï]]></dc:creator><pubDate>Mon, 23 Sep 2019 14:42:36 GMT</pubDate></item><item><title><![CDATA[Reply to ListView is not showing currentIndex on Sat, 21 Sep 2019 15:18:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mihaill">@<bdi>mihaill</bdi></a> said in <a href="/post/552247">ListView is not showing currentIndex</a>:</p>
<blockquote>
<p dir="auto">the listView does not show the currentIndex</p>
</blockquote>
<p dir="auto">the listView must show what you define in the <a href="https://doc.qt.io/qt-5/qml-qtquick-listview.html#delegate-prop" target="_blank" rel="noopener noreferrer nofollow ugc">delegate</a> property</p>
<pre><code> ListView{
     id:l
    anchors.fill: parent
    model: ["data 1","data 2","data 3"]
    currentIndex : 2
    delegate: Text {
        Rectangle{
            color: index === l.currentIndex ? "green" : "red"
            height: 30
            width: 20
        }
        id: name
        text :"DATA : "  + modelData +  " index is : " + index + "; Listview currentindex is " +  l.currentIndex
        height: 100
        MouseArea{
            anchors.fill: parent
            onClicked: l.currentIndex  = index
        }
    }
 }
</code></pre>
]]></description><link>https://forum.qt.io/post/552264</link><guid isPermaLink="true">https://forum.qt.io/post/552264</guid><dc:creator><![CDATA[ODБOï]]></dc:creator><pubDate>Sat, 21 Sep 2019 15:18:06 GMT</pubDate></item></channel></rss>