diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-02-12 08:53:00 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-02-12 16:18:28 +0000 |
commit | 8784a2778063cf928b27a908f6580ed37cb4035d (patch) | |
tree | 5a0871bc6fdd795d7971bc43c3811ee467d4ff38 /src/quick/doc/snippets/pointerHandlers | |
parent | 0e92e0bd6e7209ad491472b3928840ad78c5371a (diff) |
Use functions as signal handlers when accessing parameters
Injected signal handlers are bad practice because they aren't declared.
Task-number: QTBUG-89943
Change-Id: I3a691f68342a199bd63034637aa7ed438e3a037b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4cc91a6a0e4f9063233a4d6554ae64855cf99c14)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quick/doc/snippets/pointerHandlers')
-rw-r--r-- | src/quick/doc/snippets/pointerHandlers/tapHandlerOnTapped.qml | 6 | ||||
-rw-r--r-- | src/quick/doc/snippets/pointerHandlers/wheelHandler.qml | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/quick/doc/snippets/pointerHandlers/tapHandlerOnTapped.qml b/src/quick/doc/snippets/pointerHandlers/tapHandlerOnTapped.qml index f556c238da..deff59d034 100644 --- a/src/quick/doc/snippets/pointerHandlers/tapHandlerOnTapped.qml +++ b/src/quick/doc/snippets/pointerHandlers/tapHandlerOnTapped.qml @@ -56,9 +56,9 @@ Rectangle { TapHandler { acceptedButtons: Qt.LeftButton | Qt.RightButton - onTapped: console.log("tapped", eventPoint.event.device.name, - "button", eventPoint.event.button, - "@", eventPoint.scenePosition) + onTapped: (eventPoint)=> console.log("tapped", eventPoint.event.device.name, + "button", eventPoint.event.button, + "@", eventPoint.scenePosition) } } //![0] diff --git a/src/quick/doc/snippets/pointerHandlers/wheelHandler.qml b/src/quick/doc/snippets/pointerHandlers/wheelHandler.qml index 2c9913ac97..b3d659b4e5 100644 --- a/src/quick/doc/snippets/pointerHandlers/wheelHandler.qml +++ b/src/quick/doc/snippets/pointerHandlers/wheelHandler.qml @@ -56,8 +56,9 @@ Rectangle { WheelHandler { property: "rotation" - onWheel: console.log("rotation", event.angleDelta.y, - "scaled", rotation, "@", point.position, "=>", parent.rotation) + onWheel: (event)=> console.log("rotation", event.angleDelta.y, + "scaled", rotation, "@", point.position, + "=>", parent.rotation) } } //![0] |