QNativeGestureEvent Class

The QNativeGestureEvent class contains parameters that describe a gesture event. 更多...

头文件: #include <QNativeGestureEvent>
qmake: QT += gui
开始支持版本: Qt 5.2
基类: QInputEvent

公有函数

QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
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

其他继承的成员

  • 1 个属性继承自 QEvent
  • 1 个静态公有成员继承自 QEvent
  • 2 个受保护的变量继承自 QEvent

详细描述

The QNativeGestureEvent class contains parameters that describe a gesture event.

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 TypeDescriptionTouch equence
Qt::ZoomNativeGestureMagnification delta in percent.macOS: Two-finger pinch.
Qt::SmartZoomNativeGestureBoolean magnification state.macOS: Two-finger douple tap (trackpad) / One-finger douple tap (magic mouse).
Qt::RotateNativeGestureRotation delta in degrees.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 QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)

Constructs a native gesture event of type type.

The points 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::NativeGestureType QNativeGestureEvent::gestureType() const

Returns the gesture type.

This function was introduced in Qt 5.2.

const QPoint QNativeGestureEvent::globalPos() const

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

This function was introduced in 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.

This function was introduced in 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.

This function was introduced in Qt 5.2.

const QPointF &QNativeGestureEvent::screenPos() const

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

This function was introduced in 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.

This function was introduced in 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.

This function was introduced in Qt 5.2.