0

Buttonaと aを含む簡単な QML コードを次に示しますMouseAreaButtonマウスの左クリックと右クリックの両方を検出する必要があります。

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

4

1 に答える 1