There needs to be a way to disable the long-press feature, because it's
exclusive: if we emit longPressed(), we do not emit tapped(). But we
should also be able to accommodate slow users who pause for too long
unintentionally, or while simply observing the behavior.
Also clarify that resetting longPressThreshold reverts to the default.
Add more exhaustive test coverage, verify that longPressed
and tapped are mutually exclusive, and verify the effects of
violating the gesturePolicy.
Change longPressThreshold on LauncherList's back button so that it
always triggers, regardless whether the user pauses on it for a while.
[ChangeLog][QtQuick][Event Handlers] TapHandler.longPressThreshold
can now be set to 0 to disable its press-and-hold feature, and can be
reset to undefined to restore the platform default.
Fixes: QTBUG-119132
Task-number: QTBUG-105810
Pick-to: 6.5 6.6
Change-Id: Id5fd7e51c70fdb0cb6c4beb5615717a222aec871
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
The back button in the examples' LauncherList.qml has been flaky.
As described in the docs, a TapHandler used to implement a Button
should have `gesturePolicy: TapHandler.ReleaseWithinBounds` to get
the common behavior that you can drag out of the button to cancel
the click, and you can also drag back into the button to change your
mind and let it click after all. But when trying to test this behavior,
another problem became evident: if you spend a longer time than
longPressThreshold for the whole gesture, then at the time of release
you could see the debug output "long press threshold exceeded" and the
tapped signal was not emitted. Our intention was that if you are
dragging around, the TapHandler is not eligible to emit the longPressed
signal; it follows that it should not become ineligible to emit tapped,
either (tapped can be emitted if other constraints are satisfied).
The intention of the ReleaseWithinBounds policy is that it doesn't
matter how much you drag, as long as the point is within the bounds
of the parent at the time of release.
So we begin keeping track of whether we have actually emitted the
longPressed signal, rather than merely looking at the time difference.
This changed behavior in tst_qquickdeliveryagent::passiveGrabberOrder:
1 second is more than enough time for long press with the default
longPressThreshold, and now the tapped signals are no longer emitted
after longPressed. So we just wait for pressed state rather than
waiting so long. qWaits in tests are best avoided anyway (although
I think the intention in 152e12dc22
might have been to wait long enough to ensure that nothing undesired
would occur, rather than waiting for something specific to occur).
Task-number: QTBUG-65012
Task-number: QTBUG-105810
Pick-to: 6.5 6.6
Change-Id: If6a86d955e19810cb06de659f5e39b50a72fa762
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
In particular, use required properties where applicable, explicitly
import QtQml where we use it, avoid unqualified access into the root
scope of a component, use JavaScript functions with explicit parameters
as signal handlers.
Change-Id: I3eaaba47cc3c7a2a12d488e36f9eec145cedbb0e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Unqualified lookup in the root object of a component is bad.
Change-Id: I7772216fb81e68824519408998c73dbb1ca60c4d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The binding for x to -width will take effect after the enter-transition
finishes animating x from -page.width to 0, but will not update the x
value for some reason, so the item stays at the correct position at
the end of the transition, even if the binding is still active.
Once the window is resized though, and the new window width gets
propagated to the page component, the x-value will be re-evaluated
and the page component ends up on -width again, hiding it.
It doesn't look like the explicit property binding adds anything to
the example, as the transition takes care of starting at -width, so
by removing it we fix the issue.
Change-Id: If0e693ae85fe3e0aa49f59832cbb1ba2804b7b6b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
4e7041c652 added a convenient feature
to launch a specific test rather than needing to use the menu;
e8f3645827 broke it; and at some point
the functions removed there were added back in a way that couldn't
work (during a merge?) addExample is in use everywhere; showExample
is in use only for the pointer handlers manual test; and hideExample
isn't in use, so we can remove it again.
Change-Id: I19cacbd3324889da9768b73ec2640aa0c1de96ef
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Nothing over the top, just some page animations on enter/exit.
Change-Id: I822efe3e25928ff7797dd2911b9d2ce8dce00936
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This makes it easier to repeatedly launch the same test: specify
the qml file on the command line instead of having to click the
list item each time. e.g. ./pointer tapHandler.qml
Change-Id: I30b449b161107b1746418fc45518d202ba7d8381
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.
Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
The existing demo launcher looks rather ugly. This does some
visual tweaks to make it look better, including adding support
for proper text wrapping.
It was approved by our design lead Diana.
Change-Id: I660764575a411f598c53c9c42e290a807e20c0cf
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>