QNativeGestureEvent Class

The QNativeGestureEvent class contains parameters that describe a gesture event. More...

Header: #include <QNativeGestureEvent>
qmake: QT += gui
Since: Qt 5.2
Inherits: QInputEvent

Public Functions

QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *device, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
virtual ~QNativeGestureEvent()
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
  • 2 public functions inherited from QInputEvent
  • 7 public functions inherited from QEvent

Additional Inherited Members

  • 1 property inherited from QEvent
  • 1 public variable inherited from QEvent
  • 1 static public member inherited from QEvent
  • 2 protected variables inherited from QEvent

Detailed Description

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 Type Description Touch sequence
Qt::ZoomNativeGesture Magnification delta in percent. macOS: Two-finger pinch.
Qt::SmartZoomNativeGesture Boolean magnification state. macOS: Two-finger douple tap (trackpad) / One-finger douple tap (magic mouse).
Qt::RotateNativeGesture Rotation 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

See also Qt::NativeGestureType and QGestureEvent.

Member Function Documentation

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.

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.

This function was introduced in Qt 5.10.

[virtual] QNativeGestureEvent::~QNativeGestureEvent()

Destroys the instance of QNativeGestureEvent. The destructor is virtual.

const QTouchDevice *QNativeGestureEvent::device() const

Returns the device.

This function was introduced in Qt 5.10.

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.

See also 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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support