doc: add docs for QTest::createTouchDevice()

Task-number: QTBUG-44030
Change-Id: I4bb6a0d0a257cf94883895baebafba70d0cf0f58
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
bb10
Shawn Rutledge 2016-05-03 17:50:14 +02:00 committed by Shawn Rutledge
parent 71f507788b
commit e5ddc9b32a
2 changed files with 19 additions and 4 deletions

View File

@ -241,17 +241,18 @@ QTest::qWaitForWindowShown(&widget);
//! [24]
//! [25]
QTouchDevice *dev = QTest::createTouchDevice();
QWidget widget;
QTest::touchEvent(&widget)
QTest::touchEvent(&widget, dev)
.press(0, QPoint(10, 10));
QTest::touchEvent(&widget)
QTest::touchEvent(&widget, dev)
.stationary(0)
.press(1, QPoint(40, 10));
QTest::touchEvent(&widget)
QTest::touchEvent(&widget, dev)
.move(0, QPoint(12, 12))
.move(1, QPoint(45, 5));
QTest::touchEvent(&widget)
QTest::touchEvent(&widget, dev)
.release(0, QPoint(12, 12))
.release(1, QPoint(45, 5));
//! [25]

View File

@ -1121,6 +1121,20 @@
\sa QTest::qWaitForWindowActive(), QTest::qWaitForWindowExposed()
*/
/*!
\fn QTest::createTouchDevice()
\since 5.8
Creates a dummy touch device for simulation of touch events.
The touch device will be registered with the QPA window system interface,
and deleted automatically when the QCoreApplication is deleted. So you
should typically use createTouchDevice() to initialize a QTouchDevice
member variable in your test case class, and use the same instance for all tests.
\sa QTest::QTouchEventSequence
*/
/*!
\class QTest::QTouchEventSequence
\inmodule QtTest