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 <laszlo.agocs@theqtcompany.com>
bb10
Shawn Rutledge 2016-05-02 10:46:53 +02:00 committed by Shawn Rutledge
parent 982b70d37d
commit 04e224b19a
2 changed files with 12 additions and 0 deletions

View File

@ -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<QTouchEvent::TouchPoint> &points,
Qt::KeyboardModifiers mods = Qt::NoModifier)

View File

@ -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
{