Reputation: 339
I have the following QML:
menuBar: MenuBar {...}
header: ToolBar {...}
SplitView {
id: splitView
...
Item {
SplitView.preferredWidth: parent.width / 2
Component {
id: modDelegate
GridLayout {
id: modGrid; columns: 2; columnSpacing: 30
MouseArea {
z: 0; anchors.fill: parent; hoverEnabled: true
onEntered: ???; onExited: ???
}
CheckBox {}
ColumnLayout {
Layout.topMargin: 5
Text {...}; Text {...}; Text {...}; Text {...}
}
}
}
ListView {
id: modList; anchors.fill: parent; model: ModModel {}; delegate: modDelegate; focus: true
}
Layout.fillHeight: true
}
Item {
SplitView.preferredWidth: parent.width / 2
...
}
}
I want when I hover over an item of that ListView, that item to be visually highlighted (without preventing me from clicking the checkbox inside it of course).
Upvotes: 3
Views: 2365
Reputation: 339
I found a way to solve this in another unrelated question's answer.
I didn't saw anywhere in the docs anything mentioning that I can get the index of the item/delegate I'm in just by using index
from inside the delegate.
So I just wrapped everything inside modDelegate
into Item
and set the MouseArea
's onEntered
property to modList.currentIndex = index
Upvotes: 2