Here is some simple QML code which contains a Button and a MouseArea. I want the Button to detect both left and right mouse clicks.
Rectangle {
anchors.fill:parent;
width: 1302
height: 638
Button {
id: button1
x: 378
y: 332
width: 194
height: 66
text: qsTr("Button")
}
MouseArea {
id: mouseArea1
x: 368
y: 306
width: 226
height: 108
acceptedButtons: Qt.RightButton
propagateComposedEvents: true
onClicked: {
console.log("Click")
mouse.accepted = false
}
}
}
Since the MouseArea is positioned on top of the Button, how can I force the Button to accept the mouse events?
Button. How do you get response? Don't useanchors.fillandwidth/heighttogether. And usezif you really want to overlap one surface with another one. And as I knowButtondoesn't response to right mouse click. What exactly do you try to do here? - folibismouse.accepted=falseinsideMouseAreaevents. But see the doc if event you use affected bymouse.accepted. For example, onClick doesn't affected bymouse.accepted. - folibis