I have a global MouseArea mouseAreaRoot taking the whole screen to prevents actions on specific buttons when a popup is opened.
Within the QML objects below this global MouseArea, I have a nested MouseArea nestedMenuMouseArea handling the clicks on my menu.
The problem is that when I click on the menu, the mouse events are redirected to mouseAreaRoot and not nestedMenuMouseArea. This is the behaviour one would expect, since the global MouseArea covers the entire screen.
I would like to exclude nestedMenuMouseArea from the effects of mouseAreaRoot which prevents any actions on the other QML objects.
I read about the propagateComposedEvents attribute, but it only seems to work from child to parent.
I would like the opposite: detect from mouseAreaRoot a click onto nestedMenuMouseArea and dispatch the event to it in order to trigger its onClicked code.
As no code is here, we can not find visual stacking order.
The complete mouse area events propagation is based on your visual stacking order.
If A is parent Item, B and C are A's children, D and E are C's children...
Something like:
The rough visual stacking order is (if Z value is not exclusively specified),
So the mouse area event propagation, starts from E and reaches to A.
Unless some where mouse area's
enabledproperty is exclusively set to false.So first and most important thing you have to look for is.... How your QML parent- children are arranged.
And next is check if
enabledis false for the mouse area.and next like "folibs" said in comment,ensure you set
MouseEvent.acceptedto false along withpropagateComposedEvents: true