Reputation: 1530
I have a simple task. I want to find out whether the left or right mouse button was pressed inside TapHandler.onSingleTapped
:
TapHandler {
acceptedButtons: Qt.LeftButton | Qt.RightButton
onSingleTapped: function(eventPoint) {
// Print if it was left or right button
}
}
The supplied eventPoint does not contain this information. Where can I get this info?
Upvotes: 0
Views: 823
Reputation: 3914
Here you go, taken from TapHandler tapped() documentation:
TapHandler {
acceptedButtons: Qt.LeftButton | Qt.RightButton
onSingleTapped: function(eventPoint) {
console.log("tapped", eventPoint.event.device.name,
"button", eventPoint.event.button,
"@", eventPoint.scenePosition)
}
}
But you could also use a dedicated TapHandler
for each button type: QtWS17 - Pointer Handlers for fluid applications in Qt Quick
Upvotes: 1