qtbase/examples/widgets
Shawn Rutledge fb2db2c346 ImageGestures example: decide direction based on swipeAngle
swipeTriggered() often chose the wrong direction, because the logic
was allowing either vertical or horizontal decisions to override each
other: if you swipe to the right, but also a little upwards for example,
"up" overrode "right" and you would go back instead of forward.
It worked only if you made an effort to swipe both down and right to
go forwards, and both up and left to go back.

The docs are not wrong at least: horizontalDirection or
verticalDirection is set to NoDirection only in the case that the angle
doesn't have "a horizontal component" or "a vertical component",
respectively (assuming that's even possible). So those enum properties
are only useful if you want to detect swiping on only one axis.

Instead, we now check which side of a 45 degree line the angle is on.

Pick-to: 6.8 6.5
Task-number: QTBUG-37759
Task-number: QTBUG-46195
Change-Id: Ibd78071dc78ccaa13d63200e26a614b7017a9b1b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 646cef5a86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 5a52faa8f0)
2025-08-09 19:37:41 +00:00
..
animation Add copyright and licensing to build system files missing it 2024-05-21 17:23:21 +02:00
desktop systray example: if there is no system tray, allow waiting for one 2024-06-05 01:40:10 +00:00
dialogs Standard dialogs example: Fix compilation with QT_NO_CAST_FROM_ASCII 2025-01-21 11:26:05 +00:00
doc Doc: Fix broken links in Qt Widgets 2025-06-09 13:09:05 +00:00
draganddrop Examples: fix a couple of nodiscard warnings from QFile::open 2025-04-24 11:11:24 +00:00
gallery Widget gallery example: set color scheme before constructing UI 2024-06-11 20:28:07 +02:00
gestures ImageGestures example: decide direction based on swipeAngle 2025-08-09 19:37:41 +00:00
graphicsview Replace qdebug.h includes in public headers with forward-declarations 2025-01-15 11:28:28 +00:00
itemviews CMake: Use a unique resource identifier in simpletreemodel example 2025-01-20 17:42:01 +00:00
layouts CMake: Add deployment API to our examples 2024-03-22 20:23:52 +01:00
mainwindows CMake: Add deployment API to our examples 2024-03-22 20:23:52 +01:00
painting Use QPainterStateGuard in examples 2024-12-17 21:18:54 +00:00
qnx/foreignwindows
rhi Add missing qquaternion.h includes 2025-06-30 23:50:48 +00:00
richtext CMake: Add deployment API to our examples 2024-03-22 20:23:52 +01:00
tools Show Custom Completer example as part of UI Components category 2024-10-31 17:36:09 +02:00
touch CMake: Add deployment API to our examples 2024-03-22 20:23:52 +01:00
tutorials Notepad example: Use theme icons 2025-01-28 19:35:30 +00:00
widgets Use QPainterStateGuard in examples 2024-12-17 21:18:54 +00:00
CMakeLists.txt Correct license for examples files 2024-03-07 11:06:43 +01:00
widgets.pro Add QRhiWidget 2023-08-14 17:05:36 +02:00