Qt Declarative (Quick 2)
Go to file
Richard Moe Gustavsen 571c407ea6 DA: align delivery of mouse, touch, and synthesized mouse events to childMouseEventFilter
Currently the delivery of pointer events to childMouseEventFilters
differs depending on if the event is a mouse, touch, or synthesized
mouse event. If case of a mouse event, it will be sent to all the
filters up the parent chain, even if one of the filters along the
way returns true. If it's a touch event, propagation will stop as
soon as a filter returns true.

What does it mean that childMouseEventFilter returns true?
According to tst_QQuickWindow::testChildMouseEventFilter(), if
a childMouseEventFilter returns true, the event should be stopped
from being sent to the receiver, and only the receiver. It should
not be stopped from propagating to other childMouseEventFilters
up the parent chain. This is explicitly tested with data
row "r1 rejects and filters".

Therefore, in order to make testChildMouseEventFilter() pass, not
only for mouse events, but also for touch and synthesized mouse
events, this patch will make the following changes:

1) Remove the early 'return' statement after a touch event was
filtered by a childMouseEventFilter. This will make sure that the
touch event will continue to propagate to parent
childMouseEventFilters, equal to how it works for mouse and
synthesized mouse events.

2) For both touch-, and synthesized mouse events, we deliver a
(localized) copy of the original touch event to
childMouseEventFilter(). The filter can then choose to accept
or ignore this copy. But as it stood, we would never sync back
the accept state from the copy to the original event. The result
was that the original event would continue to propagate, regardless
of accepted state set by the filter. This patch will therefore
sync the accepted state from the copy back to the original event,
when the event is filtered. This will make sure that if a filter
e.g ignores the event, the receiver will not receive the event
(since it was filtered), and the event will propagate to the
parent (since it was ignored). Which is equal to how it works
for mouse events.

3) For both touch and synthesized mouse events, we used to always
set an exclusive grab on the affected event points if a
childMouseEventFilter filtered an event. This is different from
mouse event delivery, where we only set a grab when the event is
also accepted. And the latter is also (most likely) the correct thing
to do; If the event is ignored, it means that the filter says (on
behalf of the receiver) that it doesn't want the event. And it
doesn't make sense then (AFAICS) to still grab the event points.
This patch will therefore, equal to mouse event delivery, ensure
that we only give a filter an exclusive grab on the touch points
when the event was actually accepted.

With these changes applied, we then also change the
tst_qquickwindow::testChildMouseEventFilter() to run three times,
once for mouse event, touch events, and synthesized mouse events,
to verify that they're all aligned.

Fixes: QTBUG-115953
Pick-to: 6.7 6.6 6.5
Change-Id: I8b5b1faadc907e804b7e21c667888db7cfe28872
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2024-01-24 17:12:57 +01:00
LICENSES Use SPDX license identifiers 2022-06-11 08:05:15 +02:00
cmake Mark RegExpJitTables.h as non-module header 2023-04-03 15:38:57 +02:00
coin Change Axivion configuration 2023-10-04 14:37:59 +03:00
dist Merge qtquickcontrols2 into qtdeclarative 2021-07-28 11:21:25 +02:00
examples QQuickRhiItem API cleanup 2024-01-22 12:03:37 +01:00
features
src DA: align delivery of mouse, touch, and synthesized mouse events to childMouseEventFilter 2024-01-24 17:12:57 +01:00
tests DA: align delivery of mouse, touch, and synthesized mouse events to childMouseEventFilter 2024-01-24 17:12:57 +01:00
tools QmlFormat. Minor refactoring of the qmlformat.cpp 2024-01-23 20:34:26 +01:00
.cmake.conf Bump version to 6.8.0 2023-12-13 01:44:45 +02:00
.gitattributes qmlformat: improve testing of file based options 2021-11-04 13:35:48 +01:00
.gitignore cmake: add option to generate .qmlls.ini files 2023-08-23 12:31:08 +02:00
.gitmodules
.tag Use tree hash rather than commit hash in .tag file 2022-01-25 23:55:27 +01:00
CMakeLists.txt CMake: Add the Svg package to OPTIONAL_COMPONENTS 2023-08-21 14:10:04 +02:00
README.md Rewrite README.md 2021-08-12 13:15:17 +00:00
configure.cmake Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-09-07 17:01:30 +02:00
dependencies.yaml Update dependencies on 'dev' in qt/qtdeclarative 2024-01-22 18:25:20 +00:00
qt_cmdline.cmake Remove "2" from Qt Quick Controls directories 2022-12-01 10:26:20 +08:00
qtdeclarative.doxy