TouchEventSequence QML Type
TouchEventSequence 用于构建和分派测试用触摸事件。更多
Import Statement: | import QtTest |
方法
- TouchEventSequence commit()
- TouchEventSequence move(int touchId, object item, real x, real y)
- TouchEventSequence press(int touchId, object item, real x, real y)
- TouchEventSequence release(int touchId, object item, real x, real y)
- TouchEventSequence stationary(int touchId)
详细说明
TouchEventSequence 是通过调用TestCase.touchEvent() 创建的。该类型不能直接实例化。该类型提供的每个方法都返回相同的对象,允许链式调用。
例如
touchEvent(item).press(0).commit();
等价于
var sequence = touchEvent(item); sequence.press(0); sequence.commit();
事件会传递到包含 touchEvent 中指定项目的窗口。
另请参阅 TestCase::touchEvent()。
方法文档
TouchEventSequence commit() |
发送之前使用press(),move(),release() 和stationary() 组成的触摸事件。提交返回后,TouchEventSequence 可用于组成新事件。
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();
当TouchEventSequence 对象被销毁时,Commit 会被自动调用。
TouchEventSequence move(int touchId, object item, real x = item.width / 2, real y = item.height / 2) |
相对于item ,将touchId 移动到x 和y 所指示的位置。
项目默认为通过 touchEvent() 提供的值。X 和 y 默认为项目的中点。
TouchEventSequence press(int touchId, object item, real x = item.width / 2, real y = item.height / 2) |
在相对于item 的x 和y 所指示的点上创建一个新点,标识为touchId 。进一步使用同一触摸点时,应保持相同的 touchId。
项目默认为通过 touchEvent() 提供的值。X 和 y 默认为项目的中点。
TouchEventSequence release(int touchId, object item, real x = item.width / 2, real y = item.height / 2) |
在x 和y 相对于item 所指示的点上删除touchId 。
项目默认为通过 touchEvent() 提供的值。X 和 y 默认为项目的中点。
TouchEventSequence stationary(int touchId) |
表示touchId 存在,但与之前的事件相比没有变化。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.