【发布时间】:2021-04-02 19:28:30
【问题描述】:
我注意到列表视图会自动/默认突出显示第一项我如何禁用它并仅突出显示我在鼠标单击时选择的项目?
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
MouseArea{
anchors.fill: parent
onClicked: {
list.currentIndex = index
}
}
}
highlight: highlight
highlightFollowsCurrentItem: false
focus: true
}
我已经完成了鼠标部分,但我一直在禁用项目附加时的突出显示。
【问题讨论】:
标签: qt listview qml qqmlcomponent