QSwipeGesture Class
QSwipeGesture 类描述了用户执行的滑动手势。更多内容...
| 头文件: | #include <QSwipeGesture> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| 继承自: | QGesture |
公共类型
| enum | SwipeDirection { NoDirection, Left, Right, Up, Down } |
属性
- horizontalDirection : SwipeDirection
- swipeAngle : qreal
- verticalDirection : SwipeDirection
公共函数
| virtual | ~QSwipeGesture() |
| QSwipeGesture::SwipeDirection | horizontalDirection() const |
| void | setSwipeAngle(qreal value) |
| qreal | swipeAngle() const |
| QSwipeGesture::SwipeDirection | verticalDirection() const |
另请参阅 QPanGesture 和QPinchGesture 。
成员类型文档
enum QSwipeGesture::SwipeDirection
此枚举描述了手势沿水平轴和垂直轴可能的运动方向。
| 常量 | 值 | 描述 |
|---|---|---|
QSwipeGesture::NoDirection | 0 | 该手势在特定轴上没有相关的运动。 |
QSwipeGesture::Left | 1 | 该手势涉及向左的水平移动。 |
QSwipeGesture::Right | 2 | 该手势包含向右的水平运动。 |
QSwipeGesture::Up | 3 | 该手势包含向上垂直运动。 |
QSwipeGesture::Down | 4 | 该手势涉及向下的垂直运动。 |
属性文档
[read-only] horizontalDirection : SwipeDirection
该属性存储手势的水平方向
如果手势包含水平分量,则水平方向为“Left”(左)或“Right”(右);否则,其值为NoDirection 。
访问函数:
| QSwipeGesture::SwipeDirection | horizontalDirection() const |
另请参阅 verticalDirection 和swipeAngle 。
swipeAngle : qreal
该属性存储与该手势相关的运动角度
如果手势具有水平或垂直分量,则滑动角度描述了运动方向与基于标准控件坐标系定义的 x 轴之间的夹角。
访问函数:
| qreal | swipeAngle() const |
| void | setSwipeAngle(qreal value) |
另请参阅 horizontalDirection 和verticalDirection 。
[read-only] verticalDirection : SwipeDirection
该属性存储手势的垂直方向
如果手势具有垂直分量,则垂直方向为“Up”或“Down”;否则,为NoDirection 。
访问函数:
| QSwipeGesture::SwipeDirection | verticalDirection() const |
另请参阅 horizontalDirection 和swipeAngle 。
© 2026 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.
