本页内容

QPanGesture Class

QPanGesture 类描述了用户执行的平移手势。更多内容...

头文件: #include <QPanGesture>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
继承自: QGesture

属性

公共函数

virtual ~QPanGesture()
qreal acceleration() const
QPointF delta() const
QPointF lastOffset() const
QPointF offset() const
void setAcceleration(qreal value)
void setLastOffset(const QPointF &value)
void setOffset(const QPointF &value)

详细说明

通过平移手势移动图像的演示

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

另请参阅 QPinchGesture 和QSwipeGesture 。

属性文档

acceleration : qreal

该属性保存此手势中触点运动的加速度

访问函数:

qreal acceleration() const
void setAcceleration(qreal value)

[read-only] delta : QPointF

该属性保存了从上一个输入位置到当前输入位置的偏移量

这基本上等同于offset()与lastOffset()之间的差值。

访问函数:

QPointF delta() const

lastOffset : QPointF

该属性保存了此手势记录的最后一个偏移量

最后偏移量包含用户输入位置的变化量,该变化量由offset 属性报告,该属性在之前针对此手势发送手势事件时被记录。

如果此前未发送过包含该手势信息的事件(即该手势对象包含手势中首次移动的信息),则该属性的大小为零。

访问函数:

QPointF lastOffset() const
void setLastOffset(const QPointF &value)

offset : QPointF

该属性存储从第一个输入位置到当前输入位置的总偏移量

该偏移量衡量了输入设备上由手势覆盖的用户输入位置的总变化量。

访问函数:

QPointF offset() const
void setOffset(const QPointF &value)

成员函数文档

[virtual noexcept] QPanGesture::~QPanGesture()

析构函数。

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