diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-01-31 12:54:40 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-08-06 12:46:08 +0000 |
commit | acf7c8073b0c8a0440c62f66469865f8bf1decd5 (patch) | |
tree | 9b95b0cc7833172d9036a87cafda1b67e165945e /tests/auto/quick/qquickwindow | |
parent | 814ff4c73ced4706da8ca72e5124a59523e5efc4 (diff) |
QQuickWindow: obey AA_SynthesizeMouseForUnhandledTouchEvents
Until now, AA_SynthesizeMouseForUnhandledTouchEvents has only affected
behavior of QGuiApplicationPrivate::processTouchEvent, but had no
effect in Qt Quick. QQuickWindow also accepts the touch event
just to make sure that QGuiApplication will not synthesize mouse
from touch, because it would be redundant: QQuickWindow does that
for itself.
Now we make it have an effect in Qt Quick too: skip mouse synthesis
if it is set to false. This provides a way to simplify the
event delivery. If you set it false, then you cannot manipulate old
mouse-only items like MouseArea and Flickable on a touchscreen.
(You can of course use event handlers for that.)
[ChangeLog][QtQuick][QQuickWindow] You can now disable touch->mouse
event synthesis in QtQuick by calling
qGuiApp.setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, false);
This will simplify and speed up event delivery, and it will also prevent
any and all interaction with mouse-only items like MouseArea and
Flickable on a touchscreen.
Task-number: QTBUG-52748
Change-Id: I71f1731b5abaeabd9dbce1112cd23bc97d24c12a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickwindow')
-rw-r--r-- | tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index e0f1207ebe..578ae56cca 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -1234,8 +1234,8 @@ void tst_qquickwindow::synthMouseFromTouch() QTest::touchEvent(window.data(), touchDevice).move(0, p2, window.data()); QTest::touchEvent(window.data(), touchDevice).release(0, p2, window.data()); - QCOMPARE(item->m_touchEvents.count(), 3); - QCOMPARE(item->m_mouseEvents.count(), acceptTouch ? 0 : 3); + QCOMPARE(item->m_touchEvents.count(), !synthMouse && !acceptTouch ? 1 : 3); + QCOMPARE(item->m_mouseEvents.count(), (acceptTouch || !synthMouse) ? 0 : 3); QCOMPARE(window->m_mouseEvents.count(), 0); for (const QMouseEvent &ev : item->m_mouseEvents) QCOMPARE(ev.source(), Qt::MouseEventSynthesizedByQt); |