<?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[Highlight when scrolling through ListView]]></title><description><![CDATA[<p dir="auto">I am using QtQuick 2.3 and Qt 5.6</p>
<p dir="auto">I am having issues with how highlight moves when scrolling through my ListView and updating the currentItem. Currently I have a ListView nested in a ScrollView and the delegate each have a mouse area that updates currentIndex onEnter. When I scroll, the highlight disappears. What would the best way to implement having the highlight stay under mouse cursor while scrolling?<br />
Here is some relevant sections for how I am organizing it.</p>
<pre><code>	Component {
		id: nameDelegate
		Rectangle {
			color: "transparent"
			height: 28
			anchors.left: parent.left 
			anchors.right: parent.right 

			MouseArea {
				id: mouseArea
				hoverEnabled: true
				cursorShape: Qt.PointingHandCursor
				anchors.fill: parent
				onEntered: listView.currentIndex = index;
                                onExited: listView.currentIndex = -1;
			      }

		        }
           }

	Component {
		id: categoryDelegate
		Rectangle {
			color: "white"
			height: 30
			anchors.left: parent.left
			anchors.right: parent.right
			Text {
				id: categoryText
				anchors.verticalCenter: parent.verticalCenter
				anchors.left: parent.left
				anchors.leftMargin: 12
				font.pixelSize: 14
				color: "gray"
				text: section
			}

		}
	}

	ScrollView {
                id: scrollView
		anchors.top: searchBox.bottom	    
	        anchors.left: parent.left
	        anchors.right: parent.right
                anchors.bottom: parent.bottom

	    ListView {
	    	id: listView	    
	    	anchors.fill: parent
	    	model: insertObjectListModel
	    	delegate: nameDelegate
                highlightFollowsCurrentItem: true
		highlight: Rectangle {
			id: highlightBar
	    		width: listView.width
	    		height: 28
	    	}

	    	section {
	    		property: "category"
	    		delegate: categoryDelegate
	    	}
	    }
	}
}
</code></pre>
]]></description><link>https://forum.qt.io/topic/90136/highlight-when-scrolling-through-listview</link><generator>RSS for Node</generator><lastBuildDate>Thu, 13 Aug 2026 06:39:59 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/90136.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 24 Apr 2018 23:10:50 GMT</pubDate><ttl>60</ttl></channel></rss>