path: root/tests/auto/quick/pointerhandlers/qquickpinchhandler
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-052-20/+94
| | | | | | | | | | | | | | | | | | | | | 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>
* Remove the qmake project filesFabian Kosmale2021-01-151-16/+0
| | | | | | | | | Remove all qmake project files, except for examples which are used to test that qmake continues to work. Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-061-3/+3
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Handle ungrab and grab-cancel consistently; inform handlersShawn Rutledge2020-09-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Call onGrabChanged on Pointer Handlers during grab transitions: this was missing in a97759a336c597327cb82eebc9f45c793aec32c9. Flickable needs to receive an ungrab by child-event-filtering, in order to set its pressed state back to false (as in the cancelOnHide autotest). This is best done as a result of the QPointingDevice::grabChanged signal, while trying to send the ungrab to the item that was the grabber, rather than as a special case. Thus, QQuickWindowPrivate::onGrabChanged (the handler for the QPointingDevice::grabChanged signal) is now the only place from which we call QQuickItem::mouseUngrabEvent() and touchUngrabEvent(). But the result is that they are called in more cases than before, so some tests need adjustment. touchUngrabEvent() is not sent unless the event is available and we can verify that all points have been released. This is important for MultiPointTouchArea: it will react by ending interaction with all points at once. Another thing that's important to MPTA and multi-touch handlers is that QQuickWindowPrivate::deliverPointerEvent() must not clear grabbers of points that are not yet released, in the case that only some points are. QQuickWindowPrivate::removeGrabber() now calls QPointingDevicePrivate::removeGrabber() with its optional cancel argument, so that it will emit either a cancel or an ungrab transition. That's only relevant for Pointer Handlers, whereas QQuickItem mouseUngrabEvent and touchUngrabEvent don't make a distinction. Task-number: QTBUG-86729 Change-Id: Idf03aef2e2182398e0fc4a606c0ddbb2aaed5681 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Blacklist tests due to QPointerEvent changesShawn Rutledge2020-09-181-0/+2
| | | | | | | | | | | | | | | | qtbase/2692237bb1b0c0f50b7cc5d920eb8ab065063d47 and the associated Qt Quick change to do direct delivery of QPointerEvents seem to have broken a number of tests as they are currently written. It looks bad; however I spent a lot of time already on some older "basic" tests like tst_qquickwindow, touchmouse, tst_qquickflickable etc. and found a lot of things to fix while doing that; so at least those aren't broken now. Troubleshooting each test takes time. Hopefully it will turn out that many of these failures are related (there seems to be something in common about handlers and items stealing touch grabs from each other). Task-number: QTBUG-86729 Change-Id: I14acf57fc83fa961a25f91108dcd4aea42b54435 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* 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>
* CMake: Update Apple platform defines after rename in qtbaseTor Arne Vestbø2020-03-171-2/+2
| | | | | Change-Id: Ia0a075e3199eab735f9b289873beeb8730ebc47e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Regenerate qtdeclarativeAlexandru Croitor2020-02-121-5/+2
| | | | | | | Change-Id: I48d7fd306f3d1b161a8e73029282ee591b1ef612 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* Regenerate all projects with new CMake API versionAlexandru Croitor2019-11-151-3/+3
| | | | | | Change-Id: Ie0db35f674137c229eaf049616f38f8e818f7092 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Regenerate testsAlexandru Croitor2019-11-141-9/+2
| | | | | | Change-Id: I67a6c8f1659e7b471a4fcb92a2699292cf4eea81 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add QtDeclarative Test CoverageLeander Beernaert2019-08-141-0/+57
| | | | | | | | | | | | | | | | | | | | | | All tests compile and run on a developer build. These tests are failing: tst_qqmlsqldatabase Fails due to missing sql driver tst_qqmlsqldatabase Fails in wip/qt6 tst_ququicklayouts Fails in wip/qt6 tst_flickableinterop Fails in wip/qt6 tst_qquickpinchandler Fails in wip/qt6 tst_qquickflickable Fails in wip/qt6 tst_qquickgridview Fails in wip/qt6 tst_qquickimage Fails due to missing jpeg plugin tst_qquicklistview Fails in wip/qt6 tst_qquicktext Fails in wip/qt6 tst_qquickcanvasitem Fails in wip/qt6 tst_scenegraph Fails due to missing jpeg plugin tst_TestFiltering Fails in wip/qt6 Change-Id: I4b9d69c118e23c095cb72ad5a67653fc30943bb1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* PinchHandler: Avoid unwanted translations when axes are disabledShawn Rutledge2019-01-282-1/+89
| | | | | | Fixes: QTBUG-72822 Change-Id: I2773ba14fcb24a47fe2ec04860b4aa305a051453 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add a C++ autotest for PinchHandlerShawn Rutledge2018-08-025-0/+889
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>