QPinchGesture Class

The QPinchGesture class describes a pinch gesture made by the user. 更多...

头文件: #include <QPinchGesture>
qmake: QT += widgets
开始支持版本: Qt 4.6
基类: QGesture

公有类型

enum ChangeFlag { ScaleFactorChanged, RotationAngleChanged, CenterPointChanged }
flags ChangeFlags

属性

公有函数

~QPinchGesture()
QPointF centerPoint() const
ChangeFlags changeFlags() const
QPointF lastCenterPoint() const
qreal lastRotationAngle() const
qreal lastScaleFactor() const
qreal rotationAngle() const
qreal scaleFactor() const
void setCenterPoint(const QPointF &value)
void setChangeFlags(ChangeFlags value)
void setLastCenterPoint(const QPointF &value)
void setLastRotationAngle(qreal value)
void setLastScaleFactor(qreal value)
void setRotationAngle(qreal value)
void setScaleFactor(qreal value)
void setStartCenterPoint(const QPointF &value)
void setTotalChangeFlags(ChangeFlags value)
void setTotalRotationAngle(qreal value)
void setTotalScaleFactor(qreal value)
QPointF startCenterPoint() const
ChangeFlags totalChangeFlags() const
qreal totalRotationAngle() const
qreal totalScaleFactor() const

其他继承的成员

  • 1 个公有槽函数继承自 QObject
  • 2 个信号继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 9 个受保护的函数继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

The QPinchGesture class describes a pinch gesture made by the user.

A pinch gesture is a form of touch user input in which the user typically touches two points on the input device with a thumb and finger, before moving them closer together or further apart to change the scale factor, zoom, or level of detail of the user interface.

For an overview of gesture handling in Qt and information on using gestures in your applications, see the Gestures in Widgets and Graphics View document.

Instead of repeatedly applying the same pinching gesture, the user may continue to touch the input device in one place, and apply a second touch to a new point, continuing the gesture. When this occurs, gesture events will continue to be delivered to the target object, containing an instance of QPinchGesture in the Qt::GestureUpdated state.

参见 QPanGesture and QSwipeGesture.

成员类型

enum QPinchGesture::ChangeFlag
flags QPinchGesture::ChangeFlags

This enum describes the changes that can occur to the properties of the gesture object.

ConstantValueDescription
QPinchGesture::ScaleFactorChanged0x1The scale factor held by scaleFactor changed.
QPinchGesture::RotationAngleChanged0x2The rotation angle held by rotationAngle changed.
QPinchGesture::CenterPointChanged0x4The center point held by centerPoint changed.

The ChangeFlags type is a typedef for QFlags<ChangeFlag>. It stores an OR combination of ChangeFlag values.

参见 changeFlags and totalChangeFlags.

属性

centerPoint : QPointF

This property holds the current center point

The center point is the midpoint between the two input points in the gesture.

访问函数:

QPointF centerPoint() const
void setCenterPoint(const QPointF &value)

参见 startCenterPoint and lastCenterPoint.

changeFlags : ChangeFlags

This property holds the property of the gesture that has changed in the current step

This property indicates which of the other properties has changed since the previous gesture event included information about this gesture. You can use this information to determine which aspect of your user interface needs to be updated.

访问函数:

ChangeFlags changeFlags() const
void setChangeFlags(ChangeFlags value)

参见 totalChangeFlags, scaleFactor, rotationAngle, and centerPoint.

lastCenterPoint : QPointF

This property holds the last position of the center point recorded for this gesture

访问函数:

QPointF lastCenterPoint() const
void setLastCenterPoint(const QPointF &value)

参见 centerPoint and startCenterPoint.

lastRotationAngle : qreal

This property holds the last reported angle covered by the gesture motion

The last rotation angle is the angle as reported in the rotationAngle property when a previous gesture event was delivered for this gesture.

访问函数:

qreal lastRotationAngle() const
void setLastRotationAngle(qreal value)

参见 rotationAngle and totalRotationAngle.

lastScaleFactor : qreal

This property holds the last scale factor recorded for this gesture

The last scale factor contains the scale factor reported in the scaleFactor property when a previous gesture event included information about this gesture.

If no previous event was delivered with information about this gesture (i.e., this gesture object contains information about the first movement in the gesture) then this property contains zero.

访问函数:

qreal lastScaleFactor() const
void setLastScaleFactor(qreal value)

参见 scaleFactor and totalScaleFactor.

rotationAngle : qreal

This property holds the angle covered by the gesture motion

访问函数:

qreal rotationAngle() const
void setRotationAngle(qreal value)

参见 totalRotationAngle and lastRotationAngle.

scaleFactor : qreal

This property holds the current scale factor

The scale factor measures the scale factor associated with the distance between two of the user's inputs on a touch device.

访问函数:

qreal scaleFactor() const
void setScaleFactor(qreal value)

参见 totalScaleFactor and lastScaleFactor.

startCenterPoint : QPointF

This property holds the starting position of the center point

访问函数:

QPointF startCenterPoint() const
void setStartCenterPoint(const QPointF &value)

参见 centerPoint and lastCenterPoint.

totalChangeFlags : ChangeFlags

This property holds the property of the gesture that has change

This property indicates which of the other properties has changed since the gesture has started. You can use this information to determine which aspect of your user interface needs to be updated.

访问函数:

ChangeFlags totalChangeFlags() const
void setTotalChangeFlags(ChangeFlags value)

参见 changeFlags, scaleFactor, rotationAngle, and centerPoint.

totalRotationAngle : qreal

This property holds the total angle covered by the gesture

This total angle measures the complete angle covered by the gesture. Usually, this is equal to the value held by the rotationAngle property, except in the case where the user performs multiple rotations by removing and repositioning one of the touch points, as described above. In this case, the total angle will be the sum of the rotation angles for the multiple stages of the gesture.

访问函数:

qreal totalRotationAngle() const
void setTotalRotationAngle(qreal value)

参见 rotationAngle and lastRotationAngle.

totalScaleFactor : qreal

This property holds the total scale factor

The total scale factor measures the total change in scale factor from the original value to the current scale factor.

访问函数:

qreal totalScaleFactor() const
void setTotalScaleFactor(qreal value)

参见 scaleFactor and lastScaleFactor.

成员函数

QPinchGesture::~QPinchGesture()

Destructor.