diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-12-27 15:08:04 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-04-27 05:41:21 +0000 |
commit | 5d45aa1a6400b9fdb9bafa0559675996aff5e58a (patch) | |
tree | c5e28c73152b6c5e8b931814668910671968bb38 /tests/manual/pointer/map.qml | |
parent | f1b4348dae2b992aeaa75e4257c6db4a5182415c (diff) |
Add WheelHandler
It can be used to change any qreal property of its target Item in
response to wheel rotation, or it can be used in other ways that involve
bindings but without a target item.
[ChangeLog][QtQuick][Event Handlers] Added WheelHandler, which handles
mouse wheel rotation by modifying arbitrary Item properties.
Fixes: QTBUG-68119
Change-Id: I247e2325ee993cc1b91a47fbd6c4ba0ffde7ad49
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'tests/manual/pointer/map.qml')
-rw-r--r-- | tests/manual/pointer/map.qml | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/manual/pointer/map.qml b/tests/manual/pointer/map.qml index c400874d58..0e815ccd9c 100644 --- a/tests/manual/pointer/map.qml +++ b/tests/manual/pointer/map.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the manual tests of the Qt Toolkit. @@ -26,7 +26,7 @@ ** ****************************************************************************/ -import QtQuick 2.12 +import QtQuick 2.14 Item { width: 640 @@ -41,6 +41,20 @@ Item { height: image.height transform: Rotation { id: tilt; origin.x: width / 2; origin.y: height / 2; axis { x: 1; y: 0; z: 0 } } + WheelHandler { + id: wheelHandler + objectName: "vertical mouse wheel for scaling" + property: "scale" + onWheel: console.log("rotation " + event.angleDelta + " scaled " + rotation + " @ " + point.position + " => " + map.scale) + } + + WheelHandler { + id: horizontalWheelHandler + objectName: "horizontal mouse wheel for side-scrolling" + property: "x" + orientation: Qt.Horizontal + } + Image { id: image anchors.centerIn: parent |