このページでは

QGestureEvent Class

QGestureEvent クラスは、トリガーされたジェスチャーに関する情報を提供します。詳細...

ヘッダー: #include <QGestureEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
継承元: QEvent

パブリック関数

QGestureEvent(const QList<QGesture *> &gestures)
virtual ~QGestureEvent()
void accept(QGesture *gesture)
void accept(Qt::GestureType gestureType)
QList<QGesture *> activeGestures() const
QList<QGesture *> canceledGestures() const
QGesture *gesture(Qt::GestureType type) const
QList<QGesture *> gestures() const
void ignore(QGesture *gesture)
void ignore(Qt::GestureType gestureType)
bool isAccepted(QGesture *gesture) const
bool isAccepted(Qt::GestureType gestureType) const
QPointF mapToGraphicsScene(const QPointF &gesturePoint) const
void setAccepted(QGesture *gesture, bool value)
void setAccepted(Qt::GestureType gestureType, bool value)
QWidget *widget() const

詳細な説明

QGestureEvent クラスはジェスチャーのリストを含んでおり、gestures() 関数を使用して取得できます。

ジェスチャーは、アクティブかキャンセルされたかのいずれかです。現在実行中のジェスチャーのリストは、activeGestures() 関数を使用して取得できます。以前にアクティブで、キャンセルされたジェスチャーのリストには、canceledGestures() 関数を使用してアクセスできます。ジェスチャーは、たとえば現在のウィンドウがフォーカスを失った場合や、タイムアウト、その他の理由によりキャンセルされることがあります。

イベントハンドラが汎用関数 `QEvent::accept()` を呼び出してイベントを受け入れなかった場合、受け入れられず `Qt::GestureStarted ` 状態にある個々の `QGesture ` オブジェクトは、親ウィジェットチェーンを遡って伝播され、各オブジェクトに対して `QGestureEvent::accept()` が呼び出されて個別に受け入れられるか、イベントフィルタによってイベントが処理されるまで続きます。

関連情報

Qt におけるジェスチャ処理の概要およびアプリケーションでのジェスチャの使用方法については、『Widgets and Graphics View におけるジェスチャ』ドキュメントを参照してください。

「 QGesture 」、「QGestureRecognizer 」、「QWidget::grabGesture()」、および「QGraphicsObject::grabGesture()」も参照してください 。

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

[explicit] QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures)

gestures のリストを含む新しいQGestureEventを作成します。

[virtual noexcept] QGestureEvent::~QGestureEvent()

QGestureEvent を削除します。

void QGestureEvent::accept(QGesture *gesture)

指定されたgesture オブジェクトのacceptフラグを設定します。これは、setAccepted(gesture, true)を呼び出すのと同じ効果があります。

acceptフラグを設定すると、イベントレシーバーがそのジェスチャーを受け入れることを示します。不要なジェスチャーは親ウィジェットに伝播される場合があります。

QGestureEvent::ignore()も参照してください 。

void QGestureEvent::accept(Qt::GestureType gestureType)

指定されたgestureType のacceptフラグを設定します。これは、setAccepted(gestureType, true)を呼び出すのと同じ効果があります。

acceptフラグを設定すると、イベントレシーバーがそのジェスチャーを受け入れることを示します。不要なジェスチャーは親ウィジェットに伝播される場合があります。

QGestureEvent::ignore()も参照してください 。

QList<QGesture *> QGestureEvent::activeGestures() const

アクティブな(キャンセルされていない)ジェスチャーのリストを返します。

QList<QGesture *> QGestureEvent::canceledGestures() const

キャンセルされたジェスチャーのリストを返します。

QGesture *QGestureEvent::gesture(Qt::GestureType type) const

type によってジェスチャーオブジェクトを返します。

QList<QGesture *> QGestureEvent::gestures() const

そのイベントで配信されたすべてのジェスチャーを返します。

void QGestureEvent::ignore(QGesture *gesture)

指定されたgesture オブジェクトの「accept flag」パラメータをクリアします。これは、setAccepted(gesture, false) を呼び出すのと同じ効果があります。

acceptフラグをクリアすると、イベントレシーバーがそのジェスチャーを拒否することを示します。拒否されたジェスチャーは、親ウィジェットに伝播される場合があります。

QGestureEvent::accept()も参照してください 。

void QGestureEvent::ignore(Qt::GestureType gestureType)

指定されたgestureType のacceptフラグパラメータをクリアします。これは、setAccepted(gesture, false)を呼び出すのと同じ効果があります。

acceptフラグをクリアすると、イベントレシーバーがそのジェスチャーを望んでいないことを示します。望ましくないジェスチャーは、親ウィジェットに伝播される可能性があります。

QGestureEvent::accept()も参照してください 。

bool QGestureEvent::isAccepted(QGesture *gesture) const

gesture が受け入れられた場合はtrue を返し、そうでない場合はfalse を返します。

bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const

gestureType 型のジェスチャーが受け入れられた場合は `true ` を返し、そうでない場合は `false` を返します。

QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const

gesturePoint がグラフィックスビュー内にある場合、シーンローカル座標を返します。

この関数は、ジェスチャーイベントがQGraphicsObject に送信された際、画面座標系の点をシーンローカル座標系に変換する際に役立つ場合があります。

QPointF::isNull()も参照してください 。

void QGestureEvent::setAccepted(QGesture *gesture, bool value)

指定されたgesture オブジェクトのacceptフラグを、指定されたvalue に設定します。

acceptフラグを設定すると、イベントレシーバーがgesture を受け入れることを示します。不要なジェスチャは親ウィジェットに伝播される可能性があります。

デフォルトでは、QEvent::Gesture 型のイベントに含まれるジェスチャは受け入れられ、QEvent::GestureOverride 型のイベントに含まれるジェスチャは無視されます。

便宜上、accept フラグはaccept(gesture) で設定し、ignore(gesture) でクリアすることもできます。

isAccepted()も参照してください 。

void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value)

指定されたgestureType オブジェクトのacceptフラグを、指定されたvalue に設定します。

acceptフラグを設定すると、イベントレシーバーが指定されたタイプ(gestureType )のジェスチャーを受信することを示します。不要なジェスチャーは親ウィジェットに伝播される場合があります。

デフォルトでは、QEvent::Gesture 型のイベントに含まれるジェスチャーは受け入れられ、QEvent::GestureOverride 型のイベントに含まれるジェスチャーは無視されます。

便宜上、acceptフラグはaccept(gestureType) で設定し、ignore(gestureType) でクリアすることもできます。

QWidget *QGestureEvent::widget() const

イベントが発生したウィジェットを返します。

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