aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/touchmouse/tst_touchmouse.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Clean up tst_TouchMouseShawn Rutledge2020-11-171-424/+358
| | | | | | | | | | - The view-showing boilerplate is reduced - Uncommented and fixed up some statements that were failing at one time - Fixed override warnings - Use qCDebug not qDebug Change-Id: Ib437cc985c03776492da2502ecdb5176afadadf2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Don't synthesize mouse from touch for items that accept touchShawn Rutledge2020-11-171-98/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Followup to 1457df74f4c1d770e1e820de8cd082be1bd2489e : if an item that has acceptTouchEvents() == true merely fails to accept one touch event, that does not mean a mouse event should be sent. Finish changing the default to false: handling touch events is opt-in, just like handling mouse events; most items don't. And if you opt in, then you MUST handle touch events, because you will NOT receive mouse events as a fall-back. Now that Flickable handles touch, filtering multi-touch events becomes relevant. There was a failure in tst_touchmouse::mouseOnFlickableOnPinch when Flickable grabs a stationary touchpoint at the same time as another touchpoint is pressed, preventing a child PinchArea from reacting. So there's a new rule: just as we start over with event delivery when a new point is pressed, QQuickFlickable::filterPointerEvent() should also not immediately grab when any point is newly pressed; it can afford to wait, because it's filtering, so it will be able to see if one point is dragged past the drag threshold later on. When a parent (such as Flickable) contains only mouse-handling items (such as MouseArea), the parent should filter the touch event if it is able (if acceptTouchEvents() returns true). Flickable is now able to. Filtering parents that are not able to filter touch events can still filter a synth-mouse event as before. But filtering both must be avoided: then we would have the problem that Flickable filters a touch move, sees that it's being dragged past the drag threshold, and sets d->stealMouse to true to indicate that it wants to steal the _next_ event; then it filters a synth-mouse move, and that's perceived as being the next event even though it's just a different view of the same event, so it steals it. In tst_qquickflickable::nestedMouseAreaUsingTouch we rely on the delay caused by waiting for the next event: the MouseArea is trying to drag an item and the Flickable wants to flick; both of them decide on the same event that the drag threshold is exceeded. But MouseArea calls setKeepMouseGrab() immediately, whereas Flickable doesn't try to steal the grab until the next event, and then it sees the keepMouseGrab flag has been set, so it doesn't do it. If Flickable could filter the same event twice (once as touch, once as synth-mouse), this logic doesn't work, so it's effectively "more grabby" than intended. So it works better to have it filter only the actual touch event, not the synth-mouse that comes after. When the child has pointer handlers, we need to visit them, and therefore we should let Flickable filter a touch event on the way. tst_FlickableInterop::touchDragFlickableBehindButton() depends on this. [ChangeLog][QtQuick][QQuickWindow] In Qt 6, a QQuickItem subclass must explicitly call setAcceptTouchEvents(true) to receive QTouchEvents, and then it must handle them: we no longer fall back to sending a QMouseEvent if the touch event is not accepted. If it has additionally called setFiltersChildMouseEvents(true), then it will filter touch events, not any synthetic mouse events that may be needed for some children. Task-number: QTBUG-87018 Fixes: QTBUG-88169 Change-Id: I8784fe097198c99c754c4ebe205bef8fe490f6f4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Teach flickable to handle and replay touch as it does mouseShawn Rutledge2020-11-111-44/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickWindowPrivate::cloneMouseEvent() renamed to clonePointerEvent() and generalized to be able to clone any of the kinds of QPointerEvent that we're interested in replaying. Now it is used only in QQuickFlickablePrivate::captureDelayedPress(). Reverts f278bb7c66bb00c9f81b7a3aceeb94cb9b3a1b66 and 012a4528a515af8d7ec7dbc05a38d8fd0d6d4d1b (don't skip tst_TouchMouse::buttonOnDelayedPressFlickable). Some test changes from f128b5dee8a2a03ebc55ed0cd1e749a6599282c3 also get reverted. QEventPoint should always have valid velocity now, so Flickable no longer has to calculate it for itself. Removing that became necessary to fix the movingAndFlicking test. Adds logging categories qt.quick.flickable.filter and .replay. Fixes: QTBUG-85607 Task-number: QTBUG-83437 Task-number: QTBUG-78818 Task-number: QTBUG-61144 Task-number: QTBUG-88038 Task-number: QTBUG-88138 Change-Id: I0ed6802dff5e5d1595adddc389642925f1f2c93d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Improve tst_TouchMouse::pinchOnFlickableShawn Rutledge2020-10-281-40/+23
| | | | | | | | | | | - use for loops instead of tedious repetition - compare instead of verify to check negative bools - QTRY_COMPARE instead of qWait - move touchpoints by drag threshold to ensure repeatability: both flickable and pincharea wait for the threshold to start reacting Change-Id: I071fc05280e2156223af57d97079516987a744ab Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Remove QQuickPointerEvent etc.; deliver QPointerEvents directlyShawn Rutledge2020-09-181-39/+85
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Skip tst_TouchMouse::buttonOnDelayedPressFlickable on macOSUlf Hermann2020-09-151-0/+4
| | | | | Change-Id: I1b1b5d00ae8bef77ad63f8df5ec893b045e21923 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Replace QTouchEvent::TouchPoint with QEventPointShawn Rutledge2020-07-151-4/+4
| | | | | | | | | | | | 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>
* Temporarily skip part of tst_TouchMouse::buttonOnDelayedPressFlickableShawn Rutledge2020-07-151-0/+1
| | | | | | | | | | We can revisit tests involving the replaying of press events soon, after getting them replayed as the original type, i.e. stop synthesizing mouse for touch during replay. Task-number: QTBUG-85607 Change-Id: Ib978c84a5e61bb21e0dc017eb386cadec5390418 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-251-1/+1
| | | | | | Task-number: QTBUG-84469 Change-Id: I4c3353c00a566023503fbc178ba8454391dc334c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove QQuickPointerDevice in favor of QPointingDeviceShawn Rutledge2020-06-231-9/+4
| | | | | | | | | | | | | | ...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>
* Replace calls to deprecated QEvent accessor functionsShawn Rutledge2020-06-111-8/+8
| | | | | | | | | | | | | | | | | | | | Several event accessors were deprecated in qtbase/24e52c10deedbaef833c0e2c3ee7bee03eacc4f5. Replacements were generated by clazy using the new qevent-accessors check: $ export CLAZY_CHECKS=qevent-accessors $ export CLAZY_EXPORT_FIXES=1 $ ../qt6/configure -platform linux-clang -developer-build -debug -no-optimize-debug -opensource -confirm-license -no-pch QMAKE_CXX=clazy $ make $ cd ../../qt6/qtdeclarative $ find . -name "*.clazy.yaml" $ clang-apply-replacements . Task-number: QTBUG-20885 Task-number: QTBUG-84775 Change-Id: I1be5819506fd5039e86b4494223acbe193e6b0c9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-10-081-38/+66
|\ | | | | | | | | | | | | | | Conflicts: src/3rdparty/masm/yarr/YarrJIT.h src/quick/items/qquickwindow.cpp Change-Id: I551404e1558d56c0b0626346ad1c86406bff0ec7
| * Amend TouchMouse::buttonOnDelayedPressFlickable to test delayed tapShawn Rutledge2018-10-031-38/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test is for Flickable with pressDelay set to a testable timeout value. For some reason it only checked trying to flick before the press delay is over, or holding and waiting for the press delay to expire. But if the user taps a child MouseArea before the press delay expires (neither moving nor waiting), at the moment of release it's supposed to send the delayed press and then the release, so that the MouseArea gets "clicked" almost as if there was no delay. Lack of test coverage allowed a regression in this functionality for 2 minor versions: 5.10 and 5.11. Task-number: QTBUG-61144 Task-number: QTBUG-69059 Change-Id: I0d8867587e6877359c41ec5fc3a5cdd17447d0b8 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | QQuickWindow: obey AA_SynthesizeMouseForUnhandledTouchEventsShawn Rutledge2018-08-061-22/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, AA_SynthesizeMouseForUnhandledTouchEvents has only affected behavior of QGuiApplicationPrivate::processTouchEvent, but had no effect in Qt Quick. QQuickWindow also accepts the touch event just to make sure that QGuiApplication will not synthesize mouse from touch, because it would be redundant: QQuickWindow does that for itself. Now we make it have an effect in Qt Quick too: skip mouse synthesis if it is set to false. This provides a way to simplify the event delivery. If you set it false, then you cannot manipulate old mouse-only items like MouseArea and Flickable on a touchscreen. (You can of course use event handlers for that.) [ChangeLog][QtQuick][QQuickWindow] You can now disable touch->mouse event synthesis in QtQuick by calling qGuiApp.setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, false); This will simplify and speed up event delivery, and it will also prevent any and all interaction with mouse-only items like MouseArea and Flickable on a touchscreen. Task-number: QTBUG-52748 Change-Id: I71f1731b5abaeabd9dbce1112cd23bc97d24c12a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | Quick tests: remember positions of stationary pointsShawn Rutledge2018-07-031-24/+26
|/ | | | | | | | | | | | | | | | We need Items to receive accurate positions for stationary touch points: that is, the last-known position from the previous touch event. (And we hope that all actual touch-capable platforms also send proper QPA events with correct positions for stationary points. We assert that it's a bug if they don't.) As explained in qtbase 7cef4b6463fdb73ff602ade64b222333dd23e46c, it's OK to retain a copy of a QTest::QTouchEventSequence for this purpose, so that the QMap<int, QTouchEvent::TouchPoint> previousPoints will not be discarded between events. Change-Id: I12a04323b0d82dc325348c0fa3e067a4b63f57e9 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* stabilize tst_TouchMouse::touchButtonOnFlickableShawn Rutledge2018-03-021-1/+1
| | | | | | | | | | | | FAIL! : tst_TouchMouse::touchButtonOnFlickable() Compared values are not the same Actual (eventItem2->touchUngrabCount): 0 Expected (1) : 1 tst_touchmouse.cpp(673) : failure location Task-number: QTBUG-66278 Change-Id: I20ed910091b7c894aeaf6639d738105022730940 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* init variables where they are declared when possible (clang-tidy)Shawn Rutledge2018-02-261-6/+6
| | | | | | | | clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-21/+21
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/pointerhandlerJan Arve Saether2017-07-111-8/+4
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: examples/quick/shared/LauncherList.qml src/quick/items/qquickevents.cpp src/quick/items/qquickevents_p_p.h src/quick/items/qquickwindow.cpp tests/auto/quick/touchmouse/tst_touchmouse.cpp Change-Id: Id692d291455093fc72db61f1b854f3fc9190267b
| * Merge "Merge remote-tracking branch 'origin/5.9.0' into 5.9" into ↵Frederik Gladhorn2017-05-101-6/+3
| |\ | | | | | | | | | refs/staging/5.9
| | * Move pointerEvent instance to QQuickWindowJan Arve Saether2017-05-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With two or more windows, if events are being delivered to each, the grabbers can be different in each. We need unique instances of the QQuickPointerEvent objects for each window to avoid losing the grab state in the parent window while delivering a synthesized event to a subwindow, for example. Change-Id: I51da1212d573853969e32ad78f5b219d979a8a5c Task-number: QTBUG-57253 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| | * Fix hover delivery in case of touch release eventsFrederik Gladhorn2017-05-101-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes tst_TouchMouse::hoverEnabled. It turns out that the problem is that QQuickWindowPrivate::flushFrameSynchronousEvents would deliver artificial hover events which (due to the nature of the function) would arrive without being synchronized with the test. This should not be a problem as such, but there was one bug: the hover event would also be sent in case of a touch release event. The definition of when to "pretend hover" is a bit shaky, but we should definitely not send hover events after touch releases. By clearing lastMousePosition instead of setting it to where the touch point is released we no longer receive bogus events. Task-number: QTBUG-55350 Change-Id: I4dea54740e37182f66c4a729d7b06a1c770c34a9 Reviewed-by: Robin Burchell <robin.burchell@crimson.no> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Remove unused variableFrederik Gladhorn2017-05-101-1/+0
| |/ | | | | | | | | Change-Id: I85a5c94f8a9b1fcb52f3967f0ce521ffb34cfa0f Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | touchmouse autotest: add debug operator for the test-specific Event typeShawn Rutledge2017-05-111-0/+16
| | | | | | | | | | | | | | | | | | It's nice to be able to do qDebug() << eventItem->eventList when troubleshooting behavior in case of test failure. Change-Id: I2b50d5b092a0c9eb4eab3105be66a36aedf871bb Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Default QQuickItem::acceptTouchEvents to true until Qt 6Shawn Rutledge2017-05-101-0/+2
| | | | | | | | | | | | | | | | This is a partial revert of 1457df74f4c1d770e1e820de8cd082be1bd2489e to avoid making a mandatory API change so soon. Change-Id: I05040579fa36d3dc5ef7616861f6d17adf500d2c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Add QQuickItem acceptTouchEvents/setAcceptTouchEvents; require for touchShawn Rutledge2017-04-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has been suboptimal to speculatively deliver touch events to Items which are not interested; even worse is when we must deliver to a parent item which is filtering events, when the child Item will not accept the touch event anyway. So now it is required that any QQuickItem subclass which wishes to accept touch events must call setAcceptTouchEvents(true) (typically in its constructor). If it does not do this, it will not get any touch events (and this saves us the trouble of looking for parents which filter touch events, too). It is consistent with needing to call setAcceptHoverEvents() to get hover events, and setAcceptedMouseButtons() to get mouse events. [ChangeLog][QtQuick][QQuickItem] When subclassing QQuickItem, it is now required to call setAcceptTouchEvents(true) if you need the item to receive touch events. Change-Id: Idc76c04f4e7f1d4a613087e756e96dac368f4f23 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/pointerhandlerShawn Rutledge2017-04-131-4/+72
|\| | | | | | | Change-Id: Ie2894830470a69827d4ace3d8af9bee971e3fbd4
| * When stealing a touchpoint as synth. mouse, ungrab touchFrederik Gladhorn2017-03-011-4/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you use MultiPointTouchArea to make a button component, or if you do something similar by subclassing QQuickItem and handling touch events, and you place such a component inside a Flickable, when the user presses on the button and then drags far enough that the Flickable steals the grab, the MPTA or custom item did not receive the touchUngrabEvent() callback. Now it does, so now the button will go back to released state as a result of having the grab stolen. The situation here is special in that it's the only place where a touch event is transformed to be treated as mouse in the future, usually it's either treated as touch or mouse from the start. When this happens, it's not enough to call setMouseGrabber because that doesn't send touch cancel to the previous grabber. Instead we need to explicitly call touchUngrabEvent to notify the touch handling item. The explicit setting of the grabber which was there previously is not needed, since grabMouse will update the grab based on touchMouseId. tst_QQuickMultiPointTouchArea::inFlickable2 was already testing the pressed state of the touchpoint when the grab is stolen, but it was changed in 468626e99a90d6ac21cb311cde05c658ccb3b781; now that can be restored, and we can also un-blacklist inFlickable, which was deemed unstable in 6d163779711d4601931ae0f82910794fb2498136 [ChangeLog][QtQuick] MultiPointTouchArea, and any custom Item, will now properly receive touchUngrabEvent() when the touch grab is stolen by a filtering parent Item, such as a Flickable. Task-number: QTBUG-57910 Change-Id: I4e1b23ed099f01e7eca2e8a0e7ab4c652ef00cfa Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/pointerhandlerShawn Rutledge2017-03-021-0/+32
|\| | | | | | | Change-Id: I7e43a0a47d49de38617f6afc7548f9a9e212a851
| * Add TouchMouse::implicitUngrab autotestJan Arve Saether2017-02-281-0/+32
| | | | | | | | | | | | | | Task-number: QTBUG-57797 Task-number: QTBUG-59098 Change-Id: I3bf9ad33c22cdbd82f3efbdbfc35f63371c04bed Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | clarify further exclusive vs. passive grabsShawn Rutledge2017-02-201-3/+3
|/ | | | | | | | | | Add documentation to the grab-related event and eventpoint methods. Rename "grabber" functions which relate only to the exclusive grab, in cases where it would otherwise be ambiguous. And a few other documentation changes. Change-Id: I1a203c8c06a19d4abdb000f08b387c38341ef476 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* tst_touchmouse: Have a go at some stabilisation & improvementsRobin Burchell2017-01-111-315/+270
| | | | | | | | | | | | | | | | | | | * Use QScopedPointer to own views, preventing leakage (was a problem in a few of these tests, e.g. pinchOnFlickable/flickableOnPinch/mouseOnFlickableOnPinch) * Only qWaitForWindowActive, as the tests aren't doing anything graphical, they don't need an expose event, which means less waiting * Use the test utilities to center the windows on screen to make sure they are not under desktop chrome & have a non-null position. If position is 0,0 that means window->position().isNull() is true, so qWaitForWindowActive will wait for its entire timeout: 5 seconds. This means no "manual" tweaking of geometry anymore: the position is now taken care of by the test utilities, and we let the root QML item size determine the window size. * Move the mouse away from the window using the test utilities. Done-with: Shawn Rutledge Change-Id: I4ac6a0d56067c57ef51f186fe3cd118cab056ff2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Relax assumptions of the value of the touchMouseIdJan Arve Sæther2016-10-201-5/+12
| | | | | | | | This is needed in order to be able to integrate a change that mangles the device identifier into the touch point id in qtbase Change-Id: I7675ade377da51f8da31830c7d43875487680845 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Run tst_TouchMouse::buttonOnDelayedPressFlickable with both scenariosFrederik Gladhorn2016-10-041-1/+1
| | | | | | | | I commented the first data row out when debugging, it should have been active in the commit. Change-Id: I18ffc1ef4f67cd48a4bfbd9ec23362e07df32c7f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix behavior of Flickable::setPressDelayFrederik Gladhorn2016-10-041-18/+46
| | | | | | | | | This expands the test and fixes the code. Before this patch, items would see the press event, but get the press stolen again immediately. Change-Id: Iece1d5ffbc09a98fb4bec8d810c7ad78b0f50afe Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-211-0/+4
|\ | | | | | | | | | | | | Conflicts: src/qml/qml/qqmltypeloader.cpp Change-Id: I07647700fc86764c95a5ef95c568e700a70fe45f
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-161-0/+4
| |\ | | | | | | | | | Change-Id: Ib45654e3e79087da4754377f0d78b70c44ed4695
| | * Propagate window enter event as hover enter event in QQuickWindowEike Hein2016-09-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickWindow currently propagates window leave events as hover leave events to its content item, but it does not propagate window enter events as corresponding hover enter events. Instead, hover enter is only triggered implicitly by mouse moves. This can cause problems when there is no mouse movement inbetween the window being entered and a subsequent button press event. A common example where this occurs is dismissing a mouse-grabbing popup window (e.g. a QMenu) by clicking outside the popup, and then clicking in the same spot that was clicked to dismiss the popup. Without this patch, hover state is not realized until movement occurs, so there may be no no visual feedback and code that needs to update state based on what is being hovered prior to handling a press event can't work correctly. This patch synthesizes a QHoverEvent and delivers it in response to QEvent::Enter, similar to how QEvent::Leave is already handled. QWidget handles this correctly via QWidget::enterEvent. The equivalent in Qt Quick is QQuickItem::hoverEnterEvent, ultimately called with the synthesized event. The patch also updates the touchmouse::hoverEnabled autotest. Due to the window enter event now being handled correctly, exitSpy2 would run up a count() of 2, as the cursor was not in a neutral position after previous test cases. The change makes sure the cursor is in a neutral position before test case activity. [ChangeLog][QQuickWindow] The relevant child item is now sent a hover event when the window receives a QEnterEvent, making sure hovering is recognized without waiting for mouse movement. Change-Id: If0586f6cd971df0dfc266bb1a39c9cdb184fd286 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * | autotests: remove qWait(1) in touch sequencesShawn Rutledge2016-08-131-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After d04982dc84d66bec92b4b3767538676cf925ef17 in qtbase, QTest::touchEvent() and QTouchEventSequence::commit() slow down every sequence of touch events, so we don't need to do it in individual tests. Change-Id: Id8133b100797d4bd2d7282ee874dbb81ed2cab47 Reviewed-by: Liang Qi <liang.qi@qt.io>
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-0/+13
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4ssa_p.h tests/benchmarks/qml/qqmlimage/qqmlimage.pro tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp Change-Id: Iad11ce7fdf0c6d200fdebc16a94081bd8069a87a
| | * Flickable: avoid infinite velocity during release after dragShawn Rutledge2016-08-051-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It sometimes happens on touchscreens that mouse events occur too close together. We cannot calculate velocity based on zero elapsed time, so just ignore the event. Task-number: QTBUG-45527 Change-Id: I120e73cfa60e2fcc594cb1f3b69f530e746abddd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | | stabilize tst_TouchMouse::hoverEnabledShawn Rutledge2016-08-171-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The autotest does not generate the mouse movement that will occur if you touch an actual touchscreen on X11. QQuickWindowPrivate::flushFrameSynchronousEvents() will hover the MouseArea as if the mouse had moved, but that doesn't update QGuiApplicationPrivate::lastCursorPosition. The test checks that the synth mouse move in QQuickWindowPrivate::deliverTouchAsMouse() occurred in response to the touch release, but if flushFrameSynchronousEvents occurs before these lines QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); then it will fail because the touchpoint left mouseArea2 hovered. Also replace QVERIFY with QCOMPARE where we are comparing a value, so that when it fails we can see why. Task-number: QTBUG-55350 Change-Id: I6c9c9ff1aa57c199cdc4be59156bd36e487cbd2b Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* | | Test touch point delivery orderFrederik Gladhorn2016-08-011-0/+105
| | | | | | | | | | | | | | | Change-Id: I9b93eda0378e10bbcc274998d58f5f5ec62bb1b1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Fix TouchMouse test: accept buttonFrederik Gladhorn2016-07-311-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | That the EventItem would get an event is a bug in the current event handling, there is no reason for it to receive anything when it doesn't accept mouse/touch. Change-Id: I4079e6cb396cc1913f795015dcc7839ca79edb70 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | Touch and mouse handling: don't pre-grabFrederik Gladhorn2016-07-281-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The touchmouse test needs adjusting since we don't see ungrab events any more (which makes sense, nobody actively grabbed anything there). The comment about storing the touchMouseId early enough is invalid - any item that wants to steal the grab, has to call grab anyway. The reason to only update the grab when there is no grabber set yet, is that in the filterChildMouse stuff some other item might steal the event, setting the grabber there - that must not be overridden when we come back to the original event handling. Change-Id: I4f191b16f4d76113d0c88414b5a80eb1baf99be1 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | Keep track of grabbing inside QQuickEventPointFrederik Gladhorn2016-07-251-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | With this we can get rid of "itemForTouchPointId" which kept track of the individual grabbing of touch points. The new approach allows big cleanups and makes understanding the code easier. Change-Id: I19f7cda1b430e088ada707b2e75d97ca8dbadcc5 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | Remove unused variableFrederik Gladhorn2016-07-121-1/+0
| | | | | | | | | | | | | | | Change-Id: I47c00941ef458c8b16c02960a7b37749a222a04e Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | | Prefer public API in testFrederik Gladhorn2016-07-081-7/+7
| | | | | | | | | | | | | | | Change-Id: Ib161ffaaea57bdf74e02d0f56c3e02d484a26fcc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | tst_touchmouse: make use of new QTest::createTouchDevice functionShawn Rutledge2016-06-131-7/+1
|/ / | | | | | | | | | | | | | | | | So gui-private API isn't necessary anymore. Task-number: QTBUG-44030 Change-Id: If4e77fc99e9f6373b8dd0303c9ac52e71ed43cf7 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* / Updated license headersJani Heikkinen2016-01-201-17/+12
|/ | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I04760a0801837cfc516d1c7c02d4f503f6bb70b6 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>