Commit Graph

20 Commits

Author SHA1 Message Date
Tor Arne Vestbø f8ba365128 examples: Increase hit area of LauncherList buttons; simplify
Pick-to: 6.5 6.6 6.7
Change-Id: Ife040f9c7e01fd8b8ce80595c2179d6b78648c6e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-12-12 16:44:45 -07:00
Shawn Rutledge 8f6809681e Disable TapHandler.longPressed signal if longPressThreshold == 0
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>
2023-11-17 07:28:57 -07:00
Shawn Rutledge 1b166c87d0 Make TapHandler longPressed/tapped exclusive and reliable; fix example
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>
2023-11-17 07:28:57 -07:00
Kai Köhne b7f448f864 Examples: Do not use import version numbers anymore
Pick-to: 6.4
Change-Id: I1f4d4920bb9d132a846ac2dbcfdb8b660759d540
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-31 16:37:35 +02:00
Lucie Gérard 0dc4fd240a Use SPDX license identifiers
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>
2022-06-11 08:05:15 +02:00
Ulf Hermann 90b4528b84 Avoid discouraged patterns in examples
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>
2020-02-11 19:26:05 +01:00
Ulf Hermann 560b5bcd27 examples: Fix a few linter warnings
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>
2019-08-20 08:43:17 +02:00
Venugopal Shivashankar f6bb3c220b Example: Update the shared UI controls to use input handlers
Change-Id: I077754d9d9d713d01c7711175eb1b5da5e1f6869
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2018-10-03 15:16:10 +00:00
Tor Arne Vestbø 38151c0581 examples: Fix LauncherList page components being hidden on window resize
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>
2018-09-07 08:32:48 +00:00
Liang Qi 15dd1b7883 Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/qml/qml/qqmlimport.cpp
	src/qml/qml/qqmlimport_p.h
	src/qml/qml/qqmltypenamecache.cpp

Done-with: Ulf Hermann<ulf.hermann@qt.io>
Change-Id: I41ba7a592b2659ddf53da6952ea3b456a7bba319
2017-10-24 11:13:09 +02:00
Kai Koehne ea6cd0de3c Fix outdated BSD license header
Change-Id: Icc08925454445fc9497fb3bfd2c26efe90605983
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-10-17 11:18:11 +00:00
Shawn Rutledge 76dd5b4749 pointerhandlers manual test: get command-line arg working again
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>
2017-10-05 11:56:23 +00:00
Jan Arve Saether b6e6e737f1 Merge remote-tracking branch 'origin/dev' into wip/pointerhandler
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
2017-07-11 16:44:33 +02:00
Robin Burchell e8f3645827 LauncherList: Add some simple animations to help it look prettier
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>
2017-05-20 20:32:47 +00:00
Shawn Rutledge 4e7041c652 pointer handlers manual test: can give arg with qml to launch
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>
2017-02-14 07:01:56 +00:00
Jani Heikkinen 20c207815a Fixed license headers
Change-Id: I4d5640ff95e1361ec7e65fb3e87d7726d8185ff5
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2015-02-17 13:33:18 +00:00
Jani Heikkinen c5796292ad Update copyright headers
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>
2015-02-12 10:28:11 +00:00
Jens Bache-Wiig 9597ef6541 Improve the look and feel of our demo launcher
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>
2013-01-17 13:56:21 +01:00
Sergio Ahumada 83deab8d1b Update copyright year in Digia's license headers
Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76
Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2013-01-10 19:52:37 +01:00
Oswald Buddenhagen a6065d60f1 centralize and fixup example sources install targets
follow respective change in qtbase

Change-Id: I27502eb7ebea973e19ec5f7c3ec0e2338556f6e0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
2012-12-10 18:16:48 +01:00