QNativeGestureEvent 类

QNativeGestureEvent 类包含手势事件的描述参数。 更多...

头: #include <QNativeGestureEvent>
qmake: QT += gui
Since: Qt 5.2
继承: QInputEvent

该类在 Qt 5.2 引入。

公共函数

QNativeGestureEvent (Qt::NativeGestureType type , const QTouchDevice * device , const QPointF & localPos , const QPointF & windowPos , const QPointF & screenPos , qreal realValue , ulong sequenceId , quint64 intValue )
const QTouchDevice * device () const
Qt::NativeGestureType gestureType () const
const QPoint globalPos () const
const QPointF & localPos () const
const QPoint pos () const
const QPointF & screenPos () const
qreal value () const
const QPointF & windowPos () const

详细描述

Native gesture events are generated by the operating system, typically by interpreting touch events. Gesture events are high-level events such as zoom or rotate.

Event Type 描述 Touch sequence
Qt::ZoomNativeGesture Magnification delta in percent. macOS: Two-finger pinch.
Qt::SmartZoomNativeGesture 布尔放大状态。 macOS: Two-finger douple tap (trackpad) / One-finger douple tap (magic mouse).
Qt::RotateNativeGesture 旋转增量 (以度为单位)。 macOS: Two-finger rotate.

In addition, BeginNativeGesture and EndNativeGesture are sent before and after gesture event streams:

BeginNativeGesture ZoomNativeGesture ZoomNativeGesture ZoomNativeGesture EndNativeGesture

另请参阅 Qt::NativeGestureType and QGestureEvent .

成员函数文档编制

QNativeGestureEvent:: QNativeGestureEvent ( Qt::NativeGestureType type , const QTouchDevice * device , const QPointF & localPos , const QPointF & windowPos , const QPointF & screenPos , qreal realValue , ulong sequenceId , quint64 intValue )

Constructs a native gesture event of type type originating from device .

localPos , windowPos and screenPos specify the gesture position relative to the receiving widget or item, window, and screen, respectively.

realValue is the macOS event parameter, sequenceId and intValue are the Windows event parameters.

该函数在 Qt 5.10 引入。

const QTouchDevice *QNativeGestureEvent:: device () const

返回设备。

该函数在 Qt 5.10 引入。

Qt::NativeGestureType QNativeGestureEvent:: gestureType () const

返回手势类型。

该函数在 Qt 5.2 引入。

const QPoint QNativeGestureEvent:: globalPos () const

Returns the position of the gesture as a QPointF in screen coordinates

该函数在 Qt 5.2 引入。

const QPointF &QNativeGestureEvent:: localPos () const

Returns the position of the gesture as a QPointF , relative to the widget or item that received the event.

该函数在 Qt 5.2 引入。

const QPoint QNativeGestureEvent:: pos () const

Returns the position of the mouse cursor, relative to the widget or item that received the event.

该函数在 Qt 5.2 引入。

const QPointF &QNativeGestureEvent:: screenPos () const

Returns the position of the gesture as a QPointF in screen coordinates.

该函数在 Qt 5.2 引入。

qreal QNativeGestureEvent:: value () const

Returns the gesture value. The value should be interpreted based on the gesture type. For example, a Zoom gesture provides a scale factor while a Rotate gesture provides a rotation delta.

该函数在 Qt 5.2 引入。

另请参阅 QNativeGestureEvent and gestureType ().

const QPointF &QNativeGestureEvent:: windowPos () const

Returns the position of the gesture as a QPointF , relative to the window that received the event.

该函数在 Qt 5.2 引入。