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 }

属性

公共功能

virtual ~QSwipeGesture()
QSwipeGesture::SwipeDirection horizontalDirection() const
void setSwipeAngle(qreal value)
qreal swipeAngle() const
QSwipeGesture::SwipeDirection verticalDirection() const

详细说明

有关 Qt 中手势处理的概述以及在应用程序中使用手势的信息,请参阅《Widgets 和图形视图中的手势》(Gestures in Widgets and Graphics View)文档。

另请参阅 QPanGestureQPinchGesture

成员类型文档

enum QSwipeGesture::SwipeDirection

该枚举描述了手势沿水平轴和垂直轴运动的可能方向。

常数描述
QSwipeGesture::NoDirection0手势在特定轴上没有任何运动。
QSwipeGesture::Left1手势涉及向左的水平运动。
QSwipeGesture::Right2手势向右水平移动。
QSwipeGesture::Up3手势涉及向上的垂直运动。
QSwipeGesture::Down4手势涉及向下的垂直运动。

属性文档

[read-only] horizontalDirection : const SwipeDirection

该属性表示手势的水平方向

如果手势有水平部分,则水平方向为左或右;否则为NoDirection

访问功能:

QSwipeGesture::SwipeDirection horizontalDirection() const

另请参阅 verticalDirectionswipeAngle

swipeAngle : qreal

该属性表示与手势相关的运动角度

如果手势具有水平或垂直组件,轻扫角度描述的是运动方向与 X 轴之间的角度,该角度是使用标准 widget坐标系定义的。

访问功能:

qreal swipeAngle() const
void setSwipeAngle(qreal value)

另请参见 horizontalDirectionverticalDirection

[read-only] verticalDirection : const SwipeDirection

该属性表示手势的垂直方向

如果手势有垂直部分,则垂直方向为 "上 "或 "下";否则为NoDirection

访问功能:

QSwipeGesture::SwipeDirection verticalDirection() const

另请参阅 horizontalDirectionswipeAngle

成员函数文档

[virtual noexcept] QSwipeGesture::~QSwipeGesture()

毁灭者

© 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.