QTest::QTouchEventWidgetSequence Class

class QTest::QTouchEventWidgetSequence

The QTouchEventWidgetSequence class is used to simulate a sequence of touch events for a widget. More...

Header: #include <QTouchEventWidgetSequence>
CMake: find_package(Qt6 REQUIRED COMPONENTS Test)
target_link_libraries(mytarget PRIVATE Qt6::Test)
qmake: QT += testlib
Inherits: QTest::QTouchEventSequence

Public Functions

QTest::QTouchEventWidgetSequence &move(int touchId, const QPoint &pt, QWidget *widget = nullptr)
QTest::QTouchEventWidgetSequence &press(int touchId, const QPoint &pt, QWidget *widget = nullptr)
QTest::QTouchEventWidgetSequence &release(int touchId, const QPoint &pt, QWidget *widget = nullptr)

Detailed Description

To simulate a sequence of touch events on a widget, call QTest::touchEvent() with a pointer to a QWidget instance. Add touch events to the returned QTouchEventWidgetSequence object by calling press(), move(), release() and stationary(), and let the instance run out of scope to commit the sequence to the event system.

Member Function Documentation

QTest::QTouchEventWidgetSequence &QTouchEventWidgetSequence::move(int touchId, const QPoint &pt, QWidget *widget = nullptr)

Adds a move event for touchpoint touchId at position pt to this sequence and returns a reference to this QTouchEventWidgetSequence.

The position pt is interpreted as relative to widget. If widget is the null pointer, then pt is interpreted as relative to the widget provided when instantiating this QTouchEventWidgetSequence.

Simulates that the user moved the finger identified by touchId.

QTest::QTouchEventWidgetSequence &QTouchEventWidgetSequence::press(int touchId, const QPoint &pt, QWidget *widget = nullptr)

Adds a press event for touchpoint touchId at position pt to this sequence and returns a reference to this QTouchEventWidgetSequence.

The position pt is interpreted as relative to widget. If widget is the null pointer, then pt is interpreted as relative to the widget provided when instantiating this QTouchEventWidgetSequence.

Simulates that the user pressed the touch screen or pad with the finger identified by touchId.

QTest::QTouchEventWidgetSequence &QTouchEventWidgetSequence::release(int touchId, const QPoint &pt, QWidget *widget = nullptr)

Adds a release event for touchpoint touchId at position pt to this sequence and returns a reference to this QTouchEventWidgetSequence.

The position pt is interpreted as relative to widget. If widget is the null pointer, then pt is interpreted as relative to the widget provided when instantiating this QTouchEventWidgetSequence.

Simulates that the user lifted the finger identified by touchId.