QTouchEventWidgetSequence Class

class QTest ::QTouchEventWidgetSequence

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

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

公共函数

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)

详细描述

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 () 和 stationary (), and let the instance run out of scope to commit the sequence to the event system.

成员函数文档编制

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

Adds a move event for touchpoint touchId 在位置 pt to this sequence and returns a reference to this QTouchEventWidgetSequence .

The position pt is interpreted as relative to widget 。若 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 在位置 pt to this sequence and returns a reference to this QTouchEventWidgetSequence .

The position pt is interpreted as relative to widget 。若 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 在位置 pt to this sequence and returns a reference to this QTouchEventWidgetSequence .

The position pt is interpreted as relative to widget 。若 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 .