If I put a MouseArea on a QML element, then MouseArea will steal all mouse events.
Thus, TextEdit will be uneditable and unselectable.
TextEdit {
// some properties
MouseArea {
// some properties
onClicked: { /* do something */ }
}
}
Is there a way to solve it?
By the way, if I put a large MouseArea on another MouseArea, larger MouseArea will steal all mouse events. How do I solved it? I think passing on mouse events manually can solve that, but how to do it?
You have to enable the
MouseAreato propagate the composed events likeclickedorreleasedto the underneath component, as described by @Torgeirl's answer.If you want your
TextEdit,SliderorCheckBoxto receive these kind of events, simply pass through the event by setting itsacceptedproperty tofalse.Sample code: