From 04e224b19ab04ff4d5e0b3fa70c2669ab2656037 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 2 May 2016 10:46:53 +0200 Subject: add QTest::createTouchDevice() This enables creation of autotests which use touch events, without using private API. Task-number: QTBUG-44030 Change-Id: If8fe89f8423aaafd9e6501e231c33580b9365eb8 Reviewed-by: Laszlo Agocs --- src/gui/kernel/qwindowsysteminterface.cpp | 11 +++++++++++ src/testlib/qtesttouch.h | 1 + 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 60b2706d35..2cb9b8053f 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -920,6 +920,17 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int #endif } +namespace QTest +{ + Q_GUI_EXPORT QTouchDevice * createTouchDevice(QTouchDevice::DeviceType devType = QTouchDevice::TouchScreen) + { + QTouchDevice *ret = new QTouchDevice(); + ret->setType(devType); + QWindowSystemInterface::registerTouchDevice(ret); + return ret; + } +} + Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device, const QList &points, Qt::KeyboardModifiers mods = Qt::NoModifier) diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h index bdc964389e..11aa14c268 100644 --- a/src/testlib/qtesttouch.h +++ b/src/testlib/qtesttouch.h @@ -65,6 +65,7 @@ Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device, namespace QTest { + Q_GUI_EXPORT QTouchDevice * createTouchDevice(QTouchDevice::DeviceType devType = QTouchDevice::TouchScreen); class QTouchEventSequence { -- cgit v1.2.3