aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickwidgets
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-01-31 12:54:40 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-08-06 12:46:08 +0000
commitacf7c8073b0c8a0440c62f66469865f8bf1decd5 (patch)
tree9b95b0cc7833172d9036a87cafda1b67e165945e /tests/auto/quickwidgets
parent814ff4c73ced4706da8ca72e5124a59523e5efc4 (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/quickwidgets')
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index af358925fe..e523274d0a 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -614,8 +614,8 @@ void tst_qquickwidget::synthMouseFromTouch()
QTest::touchEvent(&window, device).move(0, p2, &window);
QTest::touchEvent(&window, device).release(0, p2, &window);
- 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(childView->m_mouseEvents.count(), 0);
for (const QMouseEvent &ev : item->m_mouseEvents)
QCOMPARE(ev.source(), Qt::MouseEventSynthesizedByQt);