aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickwheelhandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QQuickSinglePointHandler: don't reset the point in hover handlersRichard Moe Gustavsen2021-03-301-0/+2
| | | | | | | | | | | | | | | | | | A HoverHandler should not reset the reported position when it receives a mouse release. As it stands, a HoverHandler, like all the other SinglPointHandlers, will emit a position change of (0, 0) when clicking on it. This patch will factor the reset code into the virtual handleEventPoint(). By doing so, the subclasses can choose to call the base implementation to opt in for the "reset" logic. This patch will let all the subclasses, except HoverHandler, do that. Fixes: QTBUG-83980 Change-Id: Idc5720a2aad2b0b5714807965e0edc4e8325bfdc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 79cde77f23358adbe57ab8ce08730d2de5bb1288) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Pass QWheelEvent data to QML engine via QQuickWheelEvent pointerVolker Hilsheimer2021-01-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Pick-to: 6.0 Change-Id: Id86a9b30c5a8c7c50091e464e368568a7f5ca2ea Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* doc: Override the docs for the WheelHandler::acceptedDevices propertyShawn Rutledge2021-01-081-10/+21
| | | | | | | | | | | The existing docs were inherited from PointerDeviceHandler::acceptedDevices and contained the statement "By default, this property is set to AllDevices", which is true for many handlers, but not WheelHandler. Fixes: QTBUG-89861 Change-Id: I5227037ffbecedc8fdd19750e60c421383ec5581 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: Fix documentation warnings for Qt QuickTopi Reinio2020-11-051-6/+9
| | | | | | | | | | | - Remove links to modules and examples that are not part of Qt 6. - Remove links to entities marked as \internal - Add missing enum value and QML property docs where it's trivial to do so. Task-number: QTBUG-88156 Change-Id: I10a1c7bcc5fe0e2354ea69eaf24930362edb7415 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove QQuickPointerEvent etc.; deliver QPointerEvents directlyShawn Rutledge2020-09-181-21/+24
| | | | | | | | | | | | | | | | | | | | | | | QEventPoint does not have an accessor to get the QPointerEvent that it came from, because that's inconsistent with the idea that QPointerEvent instances are temporary, stack-allocated and movable (the pointer would often be wrong or null, therefore could not be relied upon). So most functions that worked directly with QQuickEventPoint before (which fortunately are still private API) now need to receive the QPointerEvent too, which we choose to pass by pointer. QEventPoint is always passed by reference (const where possible) to be consistent with functions in QPointerEvent that take QEventPoint by reference. QEventPoint::velocity() should be always in scene coordinates now, which saves us the trouble of transforming it to each item's coordinate system during delivery, but means that it will need to be done in handlers or applications sometimes. If we were going to transform it, it would be important to also store the sceneVelocity separately in QEventPoint so that the transformation could be done repeatedly for different items. Task-number: QTBUG-72173 Change-Id: I7ee164d2e6893c4e407fb7d579c75aa32843933a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add ; to Q_UNUSED and UNUSED_PARAMLars Schmertmann2020-06-261-1/+1
| | | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Iead53d18fd790fb2d870d80ef2db79666f0d2392 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove QQuickPointerDevice in favor of QPointingDeviceShawn Rutledge2020-06-231-2/+2
| | | | | | | | | | | | | | ...and generally deal with changes immediately required after adding QInputDevice and QPointingDevice. Also fixed a few usages of deprecated accessors that weren't taken care of in 212c2bffbb041aee0e3c9a7f0551ef151ed2d3ad. Task-number: QTBUG-46412 Task-number: QTBUG-69433 Task-number: QTBUG-72167 Change-Id: I93a2643162878afa216556f10808fd92e0b20071 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Register PointerScrollEvent and document the WheelHandler.wheel signalShawn Rutledge2020-01-131-1/+8
| | | | | | | | | | | Writing an onWheel() handler script was working and mentioned briefly in docs; but PointerScrollEvent and the signal were not documented. Also fixed the type of QtQuick::WheelEvent::inverted: bool not int. Fixes: QTBUG-81302 Change-Id: I31342955c42e20ff52460a1b7ee95da325e38af6 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Doc: Fix documentation warningsTopi Reinio2019-11-111-7/+9
| | | | | | | | | | | | | | | | | | There were a lot of documentation warnings introduced by the separation of QtQml.Models and QtQml.WorkerScript modules from the QtQml documentation project into their own sub-projects. Fix the above, and also ensure that the experimental Qt.labs.qmlmodels QML types are listed in the documentation, and add them also on the QML module page for QtQml.Models. A few warnings remain, they may be indicative of issues not in the scope of this commit. Fixes: QTBUG-79812 Change-Id: Idc25c976e4c96feab4aae893519d6c9245f57a64 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add WheelHandlerShawn Rutledge2019-04-271-0/+520
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>