aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/pointer
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-09-07 16:54:44 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2021-09-08 15:26:03 +0200
commit5864644ac8bc3c561696ffef5d033b1cab7d950f (patch)
tree7321b90368a93bde1921550b54166bed8f3374ec /tests/manual/pointer
parentdeccfa4636400cee32efb1ba89eda1c88921ee3a (diff)
Add button argument to the TapHandler.[single|double|]tapped signals
It would be better to emit the whole pointer event (by pointer because it's non-copyable, or make it copyable and emit by value), but we can't. So we just add the button being tapped; more information is available from the eventpoint argument and TapHandler's point property. To avoid name clashes with anything that's already called "button" in anyone's QML (which is quite likely, actually), the new signal argument is unnamed, so that users will be required to write a function signature that gives it a name rather than relying on context injection. [ChangeLog][QtQuick][Event Handlers] TapHandler's tapped(), singleTapped() and doubleTapped() signals now have two arguments: the QEventPoint instance, and the button being tapped. If you need it, you should write an explicit function for the signal handler: onTapped: function(point, button) { ... } or onDoubleTapped: (point, button)=> ... Fixes: QTBUG-91350 Task-number: QTBUG-64847 Pick-to: 6.2 6.2.0 Change-Id: I6d25300cbfceb56f27452eac4b29b66bd1b2a41a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/manual/pointer')
-rw-r--r--tests/manual/pointer/tapHandler.qml9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/manual/pointer/tapHandler.qml b/tests/manual/pointer/tapHandler.qml
index 6e51fc6fda..c25ea9eb4e 100644
--- a/tests/manual/pointer/tapHandler.qml
+++ b/tests/manual/pointer/tapHandler.qml
@@ -53,14 +53,15 @@ Item {
borderBlink.blinkColor = "red"
borderBlink.start()
}
- onTapped: { // 'eventPoint' is a signal parameter of type QEventPoint*
- console.log("tapped button " + eventPoint.event.button + " @ " + eventPoint.scenePosition +
- " on device '" + eventPoint.event.device.name + "' " + (tapCount > 1 ? (tapCount + " times") : "for the first time"))
+ onTapped: function(point, button) {
+ console.log("tapped button " + button + " @ " + point.scenePosition +
+ " on device '" + point.device.name + "' with modifiers " + handler.point.modifiers +
+ " " + (tapCount > 1 ? (tapCount + " times") : "for the first time"))
if (tapCount > 1) {
tapCountLabel.text = tapCount
flashAnimation.start()
} else {
- borderBlink.tapFeedback(eventPoint.event.button)
+ borderBlink.tapFeedback(button)
}
}
onLongPressed: longPressFeedback.createObject(rect,