QNativeGestureEvent Class

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

Header: #include <QNativeGestureEvent>
CMake: find_package(Qt6 COMPONENTS Gui REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Since: Qt 5.2
Inherits: QSinglePointEvent

Public Functions

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

Detailed Description

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 sequence
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

See also Qt::NativeGestureType and QGestureEvent.

Member Function Documentation

[since 5.10] QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *device, const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, qreal realValue, quint64 sequenceId, quint64 intValue)

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

The points localPos, scenePos and globalPos specify the gesture position relative to the receiving widget or item, window, and screen or desktop, respectively.

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

This function was introduced in Qt 5.10.

[since 5.2] Qt::NativeGestureType QNativeGestureEvent::gestureType() const

Returns the gesture type.

This function was introduced in Qt 5.2.

[since 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.

[since 5.2] 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.

[since 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.

[since 5.2] QPointF QNativeGestureEvent::screenPos() const

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

This function was introduced in Qt 5.2.

[since 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().

[since 5.2] 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.

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