Abel
24th October 2014, 11:05
Hi All,
I whan to high light the current item of listview. But the highlight bar do not update when I click , it always say at top of list.
It seems that current item never updated when mouse clicked! If I update currentItemIndex manually, the hightlight bar can move. What's wrong with it?
Rectangle {
width: 180; height: 200
ListModel {
id: contactModel
ListElement {
name: "Bill Smith"
number: "555 3264"
}
ListElement {
name: "John Brown"
number: "555 8426"
}
ListElement {
name: "Sam Wise"
number: "555 0473"
}
}
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
}
}
I whan to high light the current item of listview. But the highlight bar do not update when I click , it always say at top of list.
It seems that current item never updated when mouse clicked! If I update currentItemIndex manually, the hightlight bar can move. What's wrong with it?
Rectangle {
width: 180; height: 200
ListModel {
id: contactModel
ListElement {
name: "Bill Smith"
number: "555 3264"
}
ListElement {
name: "John Brown"
number: "555 8426"
}
ListElement {
name: "Sam Wise"
number: "555 0473"
}
}
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
}
}