TouchEventSequence is used to build and dispatch touch events for testing. 更多...
import 语句: | import QtTest 1.1 |
Since: | Qt 5.9 |
A TouchEventSequence is created by calling TestCase.touchEvent() . The type can not be directly instantiated. Each method provided by the type returns the same object, allowing chained calls.
例如:
touchEvent(item).press(0).commit();
相当于:
var sequence = touchEvent(item); sequence.press(0); sequence.commit();
Events are delivered to the window which contains the item specified in touchEvent.
另请参阅 TestCase::touchEvent() and QTest::QTouchEventSequence .
TouchEventSequence commit () |
Sends the touch event composed by prior use of press() , move() , release() ,和 stationary() . Following commit's return, the TouchEventSequence can be used to compose a new event.
var sequence = touchEvent(target); // Touch the middle of target with 1 point sequence.press(1); sequence.commit(); // Begin a new event // Move the point to target's upper left corner sequence.move(1, target, 0, 0); sequence.commit();
Commit is automatically invoked when the TouchEventSequence 对象被销毁。
TouchEventSequence move ( int touchId , 对象 item , real x = item.width / 2, real y = item.height / 2) |
移动 touchId to the point indicated by x and y relative to item .
Item defaults to the value provided via touchEvent(). X and y default to the midpoint of the item.
TouchEventSequence press ( int touchId , 对象 item , real x = item.width / 2, real y = item.height / 2) |
Creates a new point identified as touchId , at the point indicated by x and y relative to item . Further use of the same touch point should maintain the same touchId.
Item defaults to the value provided via touchEvent(). X and y default to the midpoint of the item.
TouchEventSequence release ( int touchId , 对象 item , real x = item.width / 2, real y = item.height / 2) |
移除 touchId at the point indicated by x and y relative to item .
Item defaults to the value provided via touchEvent(). X and y default to the midpoint of the item.
TouchEventSequence stationary ( int touchId ) |
指示 touchId is present but otherwise unchanged from prior events.