QNativeGestureEvent Class

QNativeGestureEventクラスは、ジェスチャーイベントを記述するパラメータを含んでいます。詳細...

ヘッダー #include <QNativeGestureEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
継承: QSinglePointEvent

パブリック関数

(since 6.2) QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *device, int fingerCount, const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, qreal value, const QPointF &delta, quint64 sequenceId = UINT64_MAX)
(since 6.2) QPointF delta() const
(since 6.2) int fingerCount() const
Qt::NativeGestureType gestureType() const
qreal value() const

詳細説明

ネイティブ ジェスチャ イベントは、オペレーティング システムによって生成されます。通常は、トラックパッドのタッチ イベントを解釈します。ジェスチャ・イベントは、ズーム、回転、パンなどの高レベルのイベントです。つまり、value ()とdelta ()は、前のイベントから現在のイベントまでの差分を提供します。

イベントタイプ説明タッチシーケンス
Qt::ZoomNativeGestureパーセント単位の倍率の差。macOSとWayland:2本指ピンチ。
Qt::SmartZoomNativeGestureブール値の拡大状態。macOS: 2本指ダブルタップ(トラックパッド)/ 1本指ダブルタップ(マジックマウス)。
Qt::RotateNativeGesture回転のデルタ(度単位)。macOS および Wayland:2本指回転。
Qt::SwipeNativeGestureスワイプ角度(度単位)。macOS: トラックパッド設定で設定可能。
Qt::PanNativeGestureピクセル単位の変位デルタ。Wayland:3本以上の指をグループとして任意の方向に動かす。

さらに、BeginNativeGestureとEndNativeGestureは、ジェスチャー・イベント・ストリームの前後に送信されます:

BeginNativeGesture ZoomNativeGesture ZoomNativeGesture EndNativeGesture。

例えば、2本指のピンチ・ジェスチャーはZoomとRotateイベントのストリームを生成し、プラットフォームによっては、PanNativeGestureはこれらとインターリーブされることがあります。

その他のタイプは独立したイベントです:SmartZoomNativeGestureとSwipeNativeGestureは、ジェスチャーが検出されるたびに1回だけ発生します。

注意: タッチパッドでは、2 本の指を 1 つのグループとして動かすジェスチャ(2 本指フリック)は通常、スクロールのために使用されます。その場合、QtはQWheelEventsを生成します。これが、PanNativeGestureを生成するために3本以上の指が必要な理由です。

Qt::NativeGestureType,QGestureEvent,QWheelEventも参照して ください。

メンバー関数ドキュメント

[since 6.2] QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *device, int fingerCount, const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, qreal value, const QPointF &delta, quint64 sequenceId = UINT64_MAX)

device を起点とし、fingerCount 指が関与するscenePos でのジェスチャを記述するtype タイプのネイティブ ジェスチャ イベントを構築します。

ポイントlocalPosscenePosglobalPos は、それぞれ受信ウィジェットまたはアイテム、ウィンドウ、画面またはデスクトップに対するジェスチャ位置を指定します。

value RotateNativeGesture または SwipeNativeGesture の場合は、度単位で角度を指定します。ZoomNativeGestureの場合、 は増分スケーリング係数で、通常は1よりずっと小さいです。ターゲットアイテムが次のようにスケールを調整する必要があることを示します: item.scale = item.scale * (1 + event.value)value

PanNativeGestureでは、delta 、ビューポート、ウィジェット、またはアイテムが移動またはパンされるべき距離をピクセル単位で示します。

注: delta は単精度 (QVector2D) で保存されるため、delta() は、場合によっては若干異なる値を返すかもしれません。これは Qt の将来のバージョンで変更される可能性があります。

この関数は Qt 6.2 で導入されました。

[since 6.2] QPointF QNativeGestureEvent::delta() const

前のイベントから移動した距離をピクセル単位で返します。パンジェスチャは、ターゲットウィジェット、アイテム、またはビューポートコンテンツを移動する距離をピクセル単位で提供します。

この関数は Qt 6.2 で導入されました。

QPanGesture::delta()も参照してください

[since 6.2] int QNativeGestureEvent::fingerCount() const

ジェスチャーに参加している指の数を返します(既知の場合)。gestureType() がQt::BeginNativeGesture またはQt::EndNativeGesture の場合、多くの場合この情報は不明で、fingerCount() は0 を返します。

この関数は Qt 6.2 で導入されました。

Qt::NativeGestureType QNativeGestureEvent::gestureType() const

ジェスチャーの種類を返します。

qreal QNativeGestureEvent::value() const

ジェスチャーの値を返します。値は、ジェスチャの種類に基づいて解釈する必要があります。たとえば、Zoom ジェスチャはスケール ファクタのデルタを提供し、Rotate ジェスチャは回転のデルタを提供します。

QNativeGestureEvent およびgestureType()も参照してください

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