Commit Graph

41 Commits

Author SHA1 Message Date
Kai Köhne fd254513db Examples: Disable QtC junction points for examples using 'shared' directory
Task-number: QTBUG-128914
Pick-to: 6.8
Change-Id: If01f7e17c1f6c033e601e2e012745461c71f2e13
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2024-09-27 14:00:08 +02:00
Fabian Kosmale 2a32ec77c0 examples: Consistently require Qt 6.8
This prevents policy warnings in a few cases, and we want people to
opt-in to new policies, so make our examples copy'n'paste friendly.

Pick-to: 6.8
Task-number: QTBUG-126201
Task-number: QTBUG-126468
Change-Id: Iefa666b61c2d2f767da3583f0f6efd8e4a2169e5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-07-03 08:43:43 +02:00
Alexandru Croitor a6bd1dc3e0 CMake: Add deployment API to our examples
Projects were modified using the tool at:
https://git.qt.io/alcroito/cmake_refactor

A few examples had to be adapted manually, mostly those that build
additional qml modules / plugins.

The INSTALL_EXAMPLESDIR and INSTALL_EXAMPLEDIR assignments were
removed, these are not needed anymore because example directory
selection is handled by the qt_internal_add_example calls.

The install(TARGETS) calls were modified according to our
documentation snippets for qt_generate_deploy_qml_app_script.

A qt_generate_deploy_qml_app_script call was added for each
executable target.

Note that the deployment step will be skipped in the CI for now,
because:
- we enable QT_DEPLOY_MINIMAL_EXAMPLES in the CI instructions and thus
  set QT_INTERNAL_SKIP_DEPLOYMENT to true
- standalone examples feature is not yet enabled in the CI, which
  means we continue to build examples in-tree, and deployment is
  disabled for in-tree prefix builds.
A small list of examples to deploy in the CI will be chosen in the
future, to ensure deployment coverage, without slowing down overall CI
times due to all the *deployqt invocations.

Even if deployment is disabled in the CI, the install(TARGETS) calls
for each example will still run, installing into an
'installed_examples' directory, which will not be archived by the CI.

The QtBundleQmlModuleForMacOS and bundle_shared code was removed,
because we can now depend on the MACOS_BUNDLE_POST_BUILD option of the
deployment api, to ensure macOS bundle examples run properly in the
build dir. This works even in prefix in-tree builds, when installation
deployment is disabled.

Finally, for all examples that build additional qml module libraries or
plugins, the libraries / plugins must be installed into the bin dir of
each project, along with a qmldir file.

This is to support running the installed project for platforms that
don't have deployment api yet, like boot2qt / yocto.

If we want to have super clean install / deployment rules in the
future, we won't be able to avoid adding ugly per-platform conditions.
The current status quo is deemed an improvement over what we had
before.

Pick-to: 6.7
Task-number: QTBUG-101340
Task-number: QTBUG-102056
Task-number: QTBUG-102057
Change-Id: I843d934668c25dbcd1abca52495b393579633fc5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-03-27 18:57:34 +01:00
Lucie Gérard 53295d9102 Correct license for examples files
Example takes precedent over build system file type.
According to QUIP-18 [1], all examples file should be
LicenseRef-Qt-Commercial OR BSD-3-Clause

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.7 6.7.0
Task-number: QTBUG-121787
Change-Id: Ie8c2539e7659f53a1fd6b48f99ee883ee9aeb0a7
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-03-21 10:41:29 +01:00
Shawn Rutledge 86081091f9 Make PieMenu in pointer handlers example work with mouse right-click
It opens instantly with right-click; whereas it animates open with
a finger or stylus, to avoid accidental activation, as before.

Pick-to: 6.5 6.6 6.7
Change-Id: I6f530fb6da67c735fe3aae4545c8040f49e8dc05
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-01-17 18:25:31 -07:00
Shawn Rutledge c5e78dd6a9 PieMenu in pointer handlers example: set preferredRendererType
We need antialiasing for those menu sector shapes to look good.

Pick-to: 6.7
Change-Id: I0dac2f5b65bf3e8e62387e5189d147de63ef0d7a
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2024-01-15 13:25:12 -07:00
Jaishree Vyas 46fc095ae4 Doc: Add example categories for qtquick
Task-number: QTBUG-116334
Pick-to: 6.5 6.6
Change-Id: I993b6157c3ef8a69e4e218d62596b5219ab4b34b
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-09-26 14:08:47 +02:00
Shawn Rutledge 1fc968c513 Move touchinteraction examples to pointerhandlers and manual test
These are getting long in the tooth, but multiflame and corkboards seem
worthwhile to update to use Pointer Handlers (as we could have done
sometime during the last 5 years or so).

The qrc prefix seems to have changed: let's get the qmake build
working again.

The multiflame example is mostly rewritten:
- all in one file, which can run standalone
- only one ParticleSystem instance (which hopefully is more efficient)
- using an inline component
- less boilerplate per component instance (only one property for
  ColoredEmitter, which is both its color and its group name)
- less-extreme, more fire-like colors

The version of corkboards in Qt Quick 3D was already updated (and then
removed for unrelated reasons); now we have the fixes from
0227fcdf3ea82efee3005d99fd1019410a7f5789

BearWhack has nice graphics, but doesn't seem like a very nice use of
multi-touch, so it's demoted to the touch manual test for now.
The simple Flickable use cases seem underwhelming nowadays too, and
we have snippets as simple as those.

Replace mentions of touchinteraction for testing with pointerhandlers.

Pick-to: 6.6
Change-Id: I4667e13e961ca6f84d3336505b3c673790babfa5
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-02 21:43:46 +02:00
Shawn Rutledge 794b6a6ab7 doc: Rename to Qt Quick Examples - Pointer Handlers
This seems to be still a consistent naming convention for example docs.

Pick-to: 6.6
Change-Id: I508526ec992222da1c971bc327dd9c83a21640aa
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-07-02 00:06:36 +02:00
Kai Köhne 2e6403f8bf Examples: Use versioned CMake targets for Qt modules
Use e.g. Qt6::Core instead of Qt::Core. This is better matching the
find_package(Qt6 ...) call, and also avoids issues that the versionless
targets have.

Pick-to: 6.5
Task-number: QTBUG-113277
Change-Id: Ib80f885e9f73fb9ad54b9e9b22cae2318877dc07
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-02 12:12:35 +02:00
Matthias Rauter 30c3a65b7b Fix button handling in MouseFeedbackSprite of pointerhandler example
HoverHandler does not react to button presses. Images to indicate button
presses are loaded but never shown because of this. This patch adds an
additional PointHandler which reacts to button presses.

Pick-to: 6.5
Change-Id: I60c1daef5144d7431605b0dc7dbedc0723a17fe0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-20 22:23:16 +00:00
Matthias Rauter 3b12b19847 Change hierarchy level of MouseFeedbackSprite in pointerhandler example
Hover events are no longer propagated to siblings when they have been
accepted by an item, at least for the time being. This patch changes
the hierarchy such that it works either way.

Fixes: QTBUG-111322
Pick-to: 6.5
Change-Id: Ied953a423954342c02e613af618be0784d6397ee
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-04-21 00:23:15 +02:00
Shawn Rutledge 9677fcf9aa handlers example: Add TapHandler single/doubleTapped signal feedback
- reserve the borderBlink feedback for these signals: the flashAnimation
  feedback is enough to show the regular tapped signal
- make the flashing border more obvious: wider on a lighter background
- make the border even wider for a double-tap
- just blink once; the 3-blink animation looked nice, like classic
  macOS, but was a bit disorienting if you are tapping multiple times
  and trying to count which signals got emitted
- stop the animation before starting the double-tap animation, to avoid
  missing it: usually the double-click interval is less than 500ms

Followup to d3f2c6ac42

Task-number: QTBUG-65088
Task-number: QTBUG-107264
Pick-to: 6.5
Change-Id: Ia2f78a7d1e758fc717078b6aa44a0f6716afd227
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-03-10 00:04:02 +01:00
Shawn Rutledge 024794255d Document the Pointer Handlers example
Animated gifs were captured with byzanz-record, then converted to webp:
gif2webp -lossy -min_size -q 40 -m 6 -mt -metadata none in.gif -o out.webp

Pick-to: 6.2 6.4 6.5
Fixes: QTBUG-96915
Change-Id: Iee2f4ef774de7862d93c7e4cdf7b2b5e0553bec4
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2023-03-02 20:31:13 +01:00
Oliver Eftevaag 32e1287f3f PointerHanders FakeFlickable: Fix ambiguous references
The max property is declared inside the "knob" rectangle.
The id of the rectangle should be used, in order to reference it
correctly.

Pick-to: 6.5
Change-Id: I157ab9c3ba687f6e0998f907f064014d03c5902f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-02-24 12:39:55 +01:00
Amir Masoud Abdol 8f7080fd09 Replace AUTO_RESOURCE_PREFIX with Qt CMake Policy in examples, tests
Every instance of AUTO_RESOURCE_PREFIX has been replaced by either
qt_standard_project_setup(REQUIRES 6.5) or with
qt_policy(SET QTP0001 NEW), mainly in tests.

In addition, I added a warning message for the case where
AUTO_RESOURCE_PREFIX is used.

Pick-to: 6.5
Task-number: QTBUG-96233
Change-Id: I323a15e9d0bb5fe6ba649365314af9fc2ad67bda
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-02-21 19:45:44 +01:00
Shawn Rutledge 40e2811843 Use SequentialAnimation.loops in FlashAnimation in handlers example
It looks less tedious. Amends 8503f884bb

Pick-to: 6.2 6.4 6.5
Change-Id: I85690e6a8ceac4ebec1c00bcbbf6a81108096e6c
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-02-21 07:02:18 +01:00
Ulf Hermann 2d44365f69 CMake: Allow omitting the version of QML modules
Also, drop all the VERSION 1.0 lines from the examples and tests. 1.0 is
actually a bad default version since it's before all the Qt versions.

[ChangeLog][QML] You can now omit the VERSION argument to
qt_add_qml_module(). This will automatically generate the highest
possible version.

Pick-to: 6.5
Task-number: QTBUG-99146
Change-Id: Ic10ec69b87c224e0e94e1785f65653815d4c778c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-01-27 19:16:39 +01:00
Oliver Eftevaag 7409c217e8 Quick examples: Modernize cmake files according to our guidelines
The following changes are made to the CMakeLists.txt files in all
quick examples:

- Use PRIVATE linkage when possible.
- Use qt_standard_project_setup()
- Set WIN32 and MACOSX_BUNDLE in qt_add_executable() instead of
  set_target_properties()

Pick-to: 6.5
Change-Id: I18217585aec56794b327f103d6959879df59d68a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-16 16:16:47 +01:00
Shawn Rutledge cae32cb2ec Use inline component in sidebar example rather than Loader
Originally in ca9e2a0d74 I used Loader as
a way of reusing some content in two places in one QML file, not
necessarily to test hover behavior with Loader. Inline components
are a little cleaner.

Pick-to: 6.2 6.4 6.5
Change-Id: Ib064bdb460704bec0c714550d8935dcef8af0637
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-01-05 06:04:16 +01:00
Shawn Rutledge e39b4572c2 map example: don't restrict pinch-zoom to center
A big advantage of PinchHandler over PinchArea is the ability to zoom
into a particular location in the target Item, so let's not fail to
show that off.

Pick-to: 6.2 6.4 6.5
Change-Id: I0f22abff99bdc60bac27e72fd5f66be4796794df
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-01-02 18:52:57 +00:00
Shawn Rutledge 7867a683fc Add PinchHandler.scaleAxis, rotationAxis; hold values in axes
Pointer Handlers that manipulate target item properties should now
use QQuickDragAxis consistently to:
- enforce minimum and maximum values
- hold the persistent and active values
- make those available via properties
- emit a new activeValueChanged(delta) signal when the value changes,
  so that it's possible to incrementally update a target item
  property in JS (onValueDelta: target.property += delta)

In the pinchHandler.qml example, you can use the PinchHandler to adjust
4 properties of one Rectangle independently (it requires coordination).

m_boundedActiveValue controls whether m_activeValue will be
kept between minimum and maximum. For rotation,
tst_QQuickPinchHandler::scaleNativeGesture() expects it to be,
although that seems questionable now, and may be addressed later.

[ChangeLog][QtQuick][Event Handlers] PinchHandler now has scaleAxis and
rotationAxis grouped properties, alongside the existing xAxis and yAxis;
and all of these now have activeValue and persistentValue properties.
The activeValueChanged signal includes a delta value, giving the
incremental change since the previous activeValue. The persistentValue
is settable, in case some target item property can be adjusted in
multiple ways: the handler's stored value can then be synced up with the
item property value after each external change. These features are
also added to DragHandler's xAxis and yAxis properties.

Task-number: QTBUG-68108
Task-number: QTBUG-76380
Task-number: QTBUG-76379
Task-number: QTBUG-94168
Change-Id: I78a5b43e9ba580448ef05054b6c4bc71b1834dd6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-12-10 03:13:57 +01:00
Shawn Rutledge d3f2c6ac42 Add TapHandler.exclusiveSignals to enable single/double tap exclusivity
If exclusiveSignals == NotExclusive (the default), behavior remains as
it was: singleTapped() and doubleTapped() are emitted as the taps occur,
so it's not very useful to react on singleTapped() if you mean to
distinguish these two cases.

If exclusiveSignals == SingleTap, the doubleTapped signal will not be
emitted at all, and therefore singleTapped can be emitted immediately
and unambiguously.

If exclusiveSignals == DoubleTap, the singleTapped signal will not be
emitted at all, and therefore doubleTapped can be emitted immediately
and unambiguously.

If exclusiveSignals == SingleTap | DoubleTap, we must wait
qApp->styleHints()->mouseDoubleClickInterval() milliseconds after a tap
is detected before emitting either signal, so that they are distinct and
can be used to drive behavior that should not occur in other cases.
A triple-tap will not trigger either signal.

[ChangeLog][QtQuick][Event Handlers] TapHandler.exclusiveSignals now
lets you make the singleTapped and doubleTapped signals exclusive.

Task-number: QTBUG-65088
Fixes: QTBUG-107264
Change-Id: Ifb2c4b72759246c64b3bfa2f776c28266806b985
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2022-10-19 06:02:33 +02:00
Lucie Gérard 1b9808737a Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: Id89ed14990804a5024183e75382cc539d4293da1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-07 17:01:30 +02: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
Shawn Rutledge 77d0ec9f84 Fix the pointerhandlers example
Amends d270c51f81

Change-Id: I616850c04facbcd7662c479d34b1a3f0a7220556
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-07-11 17:23:24 +02:00
Lucie Gérard 5a7b716474 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-07-08 10:41:06 +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
Shawn Rutledge 864dade139 Sidebar example: nest content in MouseArea to restore hover propagation
After 499828b855 if you want a MouseArea
underneath some other contents to receive propagated hover events, the
content must be inside the MouseArea, not a sibling. HoverHandler still
does not have this restriction (handlers cannot have items as children,
and the handler is not considered a sibling: it's an event-handling
facet added to the item in which it's declared).

Pick-to: 6.3 6.2
Change-Id: I5ac31d982e429ac002cb0bd7ae9c071ab927032b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-03-28 23:42:16 +02:00
Kai Köhne 9d82f4bff8 Improve examples CMakeLists.txt
- Remove # generated from xyz.pro comment from pro2cmake
- Remove "# special case" markers for pro2cmake
- Remove automatic use of CMAKE_AUTORCC
- Only opt into CMAKE_AUTOUIC if .ui files are involved
- Remove explicit setting of CMAKE_INCLUDE_CURRENT_DIR
- Combine multiple find_package(Qt6 ... calls)
 - use REQUIRED COMPONENTS
 - sort components alphabetically
- Fix wrong indentations
- Use (only) one empty line after multi-line commands

Pick-to: 6.3
Change-Id: I0d6bfb06c4b25e9921d3d2bf31d977150f12b31b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-01-24 13:25:13 +01:00
Shawn Rutledge 0d008bc0cd Fix pointer handlers example build: include piemenu, qmake support
Amends e17bfffc07 and
8503f884bb : all qml files need to be
listed in CMakeLists.txt, we need to keep qml.qrc updated too, and
we decided to keep the qmake project files.

Change-Id: Idaa4bbddabd59e79a0ae3b907319c6843d8a026a
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2021-12-12 14:39:36 +01:00
Shawn Rutledge 8326ff2ac1 Instantiator: don't interfere with delegates that assign parents
[ChangeLog][QtQml][Instantiator] Instantiator now avoids re-assigning a
delegate object's parent to itself if it was already set; thus, you can
now declare a parent assignment.

Task-number: QTBUG-64546
Task-number: QTBUG-84730
Change-Id: I7d95fa76e71c363b4cb5b7a512c2e984488c8af4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-12-10 06:52:35 +01:00
Shawn Rutledge cd5d62e999 Pointer Handlers example: show mouse wheel feedback
MouseFeedbackSprite now shows a mouse wheel animating in the same
direction as the physical mouse wheel is being rotated.

Change-Id: I08709ead3b85065723d2320d17d49adb51a00f92
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-12-10 06:52:06 +01:00
Shawn Rutledge 2b50181be8 Add HoverHandler.blocking property
As with WheelHandler, sometimes users want to let the hover events
propagate (which has been the default all along), but sometimes it's not
appropriate to allow parents of nested items to show hover feedback.

[ChangeLog][QtQuick][HoverHandler] HoverHandler now has a property
called blocking, which is false by default; but if set to true, it
prevents hover events from propagating to items "under" this handler's
parent, and their HoverHandlers.

Task-number: QTBUG-85926
Change-Id: I26f89482e294c7a6b30a55a7e23ac444a0d1ac7f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-12-09 23:16:36 +01:00
Shawn Rutledge e17bfffc07 Add TapHandler.gesturePolicy: DragWithinBounds enum value; examples
On a touchscreen, right-clicking is not directly possible; so sometimes
a long-press gesture is used as a substitute. The next thing a UI
designer would want would then be a way of showing feedback that a
long-press is in progress, rather than simply waiting for the long-press
to occur and then surprising the user with some instant action.
For example, a menu might begin to open as the user holds down the
touchpoint; but before the long-press gesture is complete, the user can
simply release, to cancel the gesture and close the menu. The timeHeld
property could drive the animation, to avoid needing a separate
animation type; in fact the reason timeHeld exists is to make it easy
to emulate this sort of touch-press animation, like one that occurs on
touchscreens since Windows 7.

But after the menu is open, the user would probably expect to be able to
drag the finger to a menu item and release, to select the menu item. For
such a purpose, the existing gesture policies weren't very useful: each
of them resets the timeHeld property if the user drags beyond the drag
threshold; so if the user expects to drag and release over a menu item,
then the timeHeld property cannot drive the menu-opening animation,
because the menu would disappear as soon as the user drags a little.

So it makes more sense to have a gesturePolicy that acts like
WithinBounds, but also applies the same policy to the timeHeld property
and the longPressed signal. We don't care about the drag threshold:
if the user is holding down a finger, it's considered to be a
long-press-in-progress, regardless of how far it has moved since press
(as long as it stays within the parent's bounds).

An example of such a menu is added.  The menu must have TapHandler as
its root object, because it reacts to press-and-drag within some larger
item, larger than the menu itself.  For example such a menu could be
used in a canvas-like application (drawing, diagramming, dragging things
like photos or file icons, or something like that): dragging items on
the canvas is possible, but long-pressing anywhere will open a context
menu. But in this example so far, only the menu is implemented.
It's a pie menu, because those are particularly touch-friendly; but
perhaps for the mouse, a conventional context menu would be used.

[ChangeLog][QtQuick][Event Handlers] TapHandler now has one more
gesturePolicy value: DragWithinBounds; it is similar to WithinBounds,
except that timeHeld is not reset during dragging, and the longPressed
signal can be emitted regardless of the drag threshold. This is useful
for implementing press-drag-release components such as menus, while
using timeHeld to directly drive an "opening" animation.

Change-Id: I298f8b1ad8f8d7d3c241ef4fdd68e7ec8d8b5bdd
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2021-12-02 12:52:58 +01:00
Ulf Hermann d7862eac1b Update examples to use new PropertyChanges
Also, prefer the multi-line syntax over ';'-separated bindings for
readability.

Change-Id: I3d6eb854e514ee257ca83773a11e6e9e10770bff
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2021-11-03 09:14:48 +01:00
Shawn Rutledge cc18223e0b Remove import versions from qml files in the pointerhandlers example
Many of these are portable to Qt 5; but we don't need the version
numbers in Qt 6, and the components that use "palette" refer to
Item.palette, which was added in Qt 6.

Pick-to: 6.2
Change-Id: Ic799fba5dd66db51a8808c52dce01d27c6da62bb
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-27 12:35:15 +00:00
Shawn Rutledge c61cfa8487 Fix pointerhandlers/fakeFlickable example
TapHandlerButton is not in this example: we just call it Button.
Amends 8503f884bb

Pick-to: 6.2
Change-Id: I49bc6081f05642cd938a257c14c10497bfafb8a8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-10-26 12:04:34 +02:00
Oliver Eftevaag e2532e8773 Pointerhandlers example: fix CMakeLists.txt linking error
Fixes: QTBUG-97466
Pick-to: 6.2
Change-Id: I9bb0b79b12cbd43209f56137bbdb67ca2457ca6c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-26 10:03:30 +00:00
Shawn Rutledge e57ba6916e Large Text: populate only lines visible in Window into SG
Text is rendered top-to-bottom: QQuickTextNode::addTextLayout()
iterates lines of text.  Now it first maps the window size() rectangle
into the Text item's coordinate system, and treats that as the viewport:
lines whose y coordinates fall outside are omitted.
This saves a huge amount of time and memory when the text is large.
So Flickable { Text { } } can actually be used in an ebook reader now,
for example.

QQuickItemPrivate::transformChanged(parent) is now used to inform
all children when a parent moves; so e.g. when a content item is
moved inside a "viewport" item (like a Flickable, or any other item
that is being used as a clipping viewport or just as a holder),
all children of the content item will be notified; and QQuickTextPrivate
uses this occasion to mark itself dirty so that the updatePaintNode()
will be called again.  This happens directly after the actual movement:

  QQuickTextPrivate::transformChanged  qquicktext.cpp        2990
  QQuickItemPrivate::transformChanged  qquickitem.cpp        5200
  QQuickItemPrivate::dirty             qquickitem.cpp        6339
  QQuickItem::setY                     qquickitem.cpp        6830
  QQuickFlickablePrivate::setViewportY qquickflickable.cpp   1800

Task-number: QTBUG-60491
Task-number: QTBUG-90734
Change-Id: I152d23caa725f194a186a604fbc8d0c07f597b16
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2021-09-29 16:14:44 +02:00
Shawn Rutledge 8503f884bb Move most of the pointer manual tests to a new pointerhandlers example
They were always meant to be examples eventually. Now they will be used
for an example of how to implement custom controls using only basic
items and handlers. Some components are very similar to those in
the shared directory; but most examples will use Qt Quick Controls,
so those shared components can be removed when we no longer use them.
This example should remain as the one that shows how to build
reusable controls "from scratch".

Removed InputInspector because it's inefficient, has limited usefulness,
tends to require building the manual test to be able to run it, and
could be better built as a reusable Qt.labs component later on,
providing a model with all known devices and taking advantage of the
QPointingDevice::grabChanged signal to track the grab states rather
than polling.

Pick-to: 6.2
Change-Id: I47ab6ebb2cecab07a69cf96e546ffd0db3026a60
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-09-24 17:03:19 +02:00