在下面的代码中,如果委托 Item 是 Rectangle,即使 Rectangle 继承了 Item,突出显示也不起作用,这是一个错误,还是我遗漏了什么。
ListView {
width: 200
height: 500
focus: true
highlight: Component {
Rectangle {
width: 200
height: 20
color: "red"
}
}
model: ListModel {ListElement {name: "dummy 1"} ListElement {name: "dummy 2"}}
delegate: Item { // If Item is replaced with Rectangle highlight does not work even though Rectangle inherits Item
width: 200
height: 20
Text {
text: name
}
}
}