how to set hightlight color to qml listview item
Solved
QML and Qt Quick
-
new to qml. I set alternative colors to items inside qml listview. But the highlight color "lightsteelblue" does not show up. What is wrong?
ListView { id: nameListView anchors.fill: parent snapMode: ListView.SnapToItem spacing: 0 focus: true interactive: false model: nameListModel property int selectedRow: 1 delegate: Rectangle { id: infoDelegate width: nameListView.width height: menubar.height * 0.8 color: index % 2 == 0 ? "lightgray" : "black" Text { anchors.centerIn: parent font.pixelSize: 24 text: itemTime color: "white" } MouseArea { anchors.fill: infoDelegate onClicked: { nameListView.selectedRow = index } } } highlight: Rectangle { color: "lightsteelblue" } }
-
You can set z on your highlight to something like 5. This should raise it above the delegate.