aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickwheelhandler_p_p.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-01-14 19:29:45 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-01-15 15:39:43 +0000
commit76b2d6b7e50ce211641fc6aa9a902719a124e9ca (patch)
treefacbd3e4e58ee0e6fcc1af967c27c939b9eb872b /src/quick/handlers/qquickwheelhandler_p_p.h
parentae8fb3800ac880bfa9805f9163709d96b66b7788 (diff)
Pass QWheelEvent data to QML engine via QQuickWheelEvent pointer
Passing events as objects or references in signal parameters requires copying, and we removed the broken copy semantics from QEvent for Qt 6 as much as possible. QVariant::fromValue still allows creation of a QVariant from a type that doesn't have a (public) copy constructor, which is why this passing of a QWheelEvent through a QVariant to QML went unnoticed. While QWheelEvent is a gadget and thus supposed to be invokable from QML, it's still a QEvent. Most QEvents are not gadgets - like QKeyEvent, QMouseEvent, QTouchEvent. We have QQuick*Event QObject wrappers instead to provide access to the low level event data from QML. So, use a single QQuickWheelEvent object instead to pass the data to QML, that class is designed for exactly that prupose. We need to copy the data anyway, and since we don't need to create/destroy the wrapper object for each event, this has no practical overhead. Extend the QQuickWheelEvent to provide access to the phase information of QWheelEvent as well, and simplify the reset() method. Note: making the QQuickWheelEvent store the QWheelEvent directly would allow passing calls to setAccepted through to the QWheelEvent. That is left for a future cleanup, and another reason for not passing events around as copies. Fixes: QTBUG-89594 Change-Id: Id86a9b30c5a8c7c50091e464e368568a7f5ca2ea Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 2b15a1fbe2f26a090f79ab5aa238f375bc67fda3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quick/handlers/qquickwheelhandler_p_p.h')
-rw-r--r--src/quick/handlers/qquickwheelhandler_p_p.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickwheelhandler_p_p.h b/src/quick/handlers/qquickwheelhandler_p_p.h
index d35e04c51b..b18f83cb16 100644
--- a/src/quick/handlers/qquickwheelhandler_p_p.h
+++ b/src/quick/handlers/qquickwheelhandler_p_p.h
@@ -80,6 +80,7 @@ public:
mutable bool metaPropertyDirty = true;
bool invertible = true;
bool targetTransformAroundCursor = true;
+ QQuickWheelEvent wheelEvent;
};
QT_END_NAMESPACE