I want to create a QML item which disappears when the mouse moves outside of it. Here is my code:
Item {
id: disappearing_element
ListView { ... }
MouseArea {
id: collapser
anchors.fill: parent
propagateComposedEvents: true
hoverEnabled: true
onExited: {
disappearing_element.visible = false
}
}
}
It works well, but MouseArea
propagates events like onClicked()
onDoubleClicked()
only (as said in Qt docs).
Is there a way to notify disappearing_element
's childrens about mouse enter and mouse exit events (without using a Popup
element)?
disappearing_element.visible
for notifications to the children by binding to it, i.e.property bool someProp : parent.visible; onSomePropChanged: { ...your stuff... }
– dtechdisappearing_element
's childrens to check if one of them contains mouse cursor or not. – Deedee MegadoodooItem itemAt(int x, int y)
function ofListView
? – dtechcontentItem
in between. – dtech