Button
aと aを含む簡単な QML コードを次に示しますMouseArea
。Button
マウスの左クリックと右クリックの両方を検出する必要があります。
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
}
}
}
はMouseArea
の上に配置されているため、マウス イベントを強制的に受け入れるにはButton
どうすればよいですか?Button