aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Emit grabChanged() from DragHandler and PinchHandlerShawn Rutledge2021-05-271-0/+4
| | | | | | | | | | | | Followup to ca7cdd71ee33f0d77eb6bf1367d2532e26155cb2 : when overriding a virtual function, it's good practice to call the base class function, in the absence of any reason not to. Fixes: QTBUG-93880 Change-Id: Icbd04faec51d55d8fbf73319bd20f5846761d3d5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit a10eeee97d42f05409074f69cc99d9a8da5db077) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* DragHandler: don't try to handle native gesture eventsShawn Rutledge2021-05-051-20/+32
| | | | | | | | | | | | | | | | | | | | | No gesture handling has been implemented in DragHandler (although we could). It just made the target item jump unintentionally. QQuickMultiPointHandler::wantsPointerEvent() returns true for gestures, because PinchHandler handles them, and the pattern is that base classes only rule out some kinds of events but leave the final decision up to the leaf class. The autotest has to use a touchpad now, not the primary pointing device, because QQuickPointerDeviceHandler::wantsPointerEvent() returns false if pointerType != Finger and acceptedButtons() is not satisfied. Fixes: QTBUG-92165 Change-Id: I984de750c9ae892f3ee61c7ed5b3ac4a7d187024 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 73051631545dc59d4419a5ef2202355349aab480) Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* PinchHandler: scale incrementally when new pinch gesture beginsShawn Rutledge2021-03-251-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | When the gesture begins, we begin multiplying the target item's scale by 1.0 at first; it doesn't make sense to start immediately with the accumulated scale remembered from previous pinch gestures, because the target item remembers its own scale. When QQuickPinchHandler::wantsPointerEvent() returns false because some irrelevant gesture was received (for example a PanNativeGesture), that's not a good reason to deactivate. Deactivating and re-activating with each ZoomNativeGesture event results in extreme behavior, because PinchHandler depends on the BeginNativeGesture and EndNativeGesture events to reset internal state. Likewise, the fact that the button state is NoButton is not a good reason for wantsPointerEvent() to return false. Added an autotest: the first of its kind that actually simulates the native gesture events. Fixes: QTBUG-92064 Change-Id: I3a9b92d70f99497ee58ad8557d90d521fbe16d41 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit fc636af3a723ee8b4ee42cf71864ae0df5ca4621) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Begin handling the QEvent refactoringShawn Rutledge2020-07-151-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | This is an intermediate step to get Qt Quick working again after qtbase 4e400369c08db251cd489fec1229398c224d02b4. - QQuickEventPoint::id() is no longer unique across devices, because now eventPoint.event.device tells which specific device the event comes from. (In Qt 5, we could not yet add the device pointer to QInputEvent.) - However, MultiPointTouchArea's docs say that each pointId is unique, and so do the HandlerPoint docs (for similar use cases with PointHandler). So we still need the same hack using a Qt-specific short device ID to unique-ify the QEventPoint::id(). Now we use the device index in QInputDevice::devices() as the short ID. - Otherwise, we trust QInputDevice::systemId() and QEventPoint::id() more than before. - Use QMutable* classes from qevent_p.h to continue using setters that were in QTouchEvent before, etc. But setTouchPoints() is not there, so we have to make new event instances in a couple of cases. - QGuiApplicationPrivate::setMouseEventCapsAndVelocity() and setMouseEventSource() are gone. - Use (compiler-written) event copy constructors when possible. Task-number: QTBUG-72173 Change-Id: I3915dc535ae4c5a81cbf333aba9355f01c420c15 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Replace QTouchEvent::TouchPoint with QEventPointShawn Rutledge2020-07-151-2/+2
| | | | | | | | | | | | It's a cosmetic change at this time, because we have declared using TouchPoint = QEventPoint; Also replace Qt::TouchPointState enum with QEventPoint::State. Task-number: QTBUG-72173 Change-Id: Ife017aa98801c28abc6cccd106f47a95421549de Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove QQuickPointerDevice in favor of QPointingDeviceShawn Rutledge2020-06-231-14/+3
| | | | | | | | | | | | | | ...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>
* PinchHandler: Avoid unwanted translations when axes are disabledShawn Rutledge2019-01-281-0/+80
| | | | | | Fixes: QTBUG-72822 Change-Id: I2773ba14fcb24a47fe2ec04860b4aa305a051453 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add a C++ autotest for PinchHandlerShawn Rutledge2018-08-021-0/+692
Adapted from the PinchArea test. cancel() does not work, TDB if we want to support that Done-with: Jan-Arve Sæther <jan-arve.saether@qt.io> Task-number: QTBUG-69134 Change-Id: I63dfba7b327220b9f032f19c588cc19ebdfd95c2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>