QPointingDevice Class

QPointingDeviceクラスは、マウスやタッチ、タブレットのイベントが発生するデバイスを記述します。詳細...

ヘッダー #include <QPointingDevice>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
以来:Qt 6.0
継承: QInputDevice

パブリックタイプ

enum GrabTransition { GrabExclusive, UngrabExclusive, CancelGrabExclusive, GrabPassive, UngrabPassive, …, OverrideGrabPassive }
enum class PointerType { Unknown, Generic, Finger, Pen, Eraser, …, AllPointerTypes }
flags PointerTypes

パブリック関数

QPointingDevice(QObject *parent = nullptr)
QPointingDevice(const QString &name, qint64 id, QInputDevice::DeviceType deviceType, QPointingDevice::PointerType pointerType, QInputDevice::Capabilities capabilities, int maxPoints, int buttonCount, const QString &seatName = QString(), QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(), QObject *parent = nullptr)
int buttonCount() const
int maximumPoints() const
QPointingDevice::PointerType pointerType() const
QPointingDeviceUniqueId uniqueId() const

シグナル

void grabChanged(QObject *grabber, QPointingDevice::GrabTransition transition, const QPointerEvent *event, const QEventPoint &point) const

静的パブリック・メンバー

const QPointingDevice *primaryPointingDevice(const QString &seatName = QString())

詳細説明

QPointerEvent は、タイプや能力のようなデバイス固有のプロパティにアクセスできるように、QPointingDevice ポインタを含んでいます。ポインタ・イベントを生成する前に、QWindowSystemInterfaceを介して利用可能なポインティング・デバイスを登録するのは、プラットフォームまたはジェネリック・プラグインの責任です。アプリケーションはこのクラスをインスタンス化する必要はなく、QPointerEvent::device()が指すグローバルインスタンスにアクセスするだけでよい。

メンバ型ドキュメント

enum QPointingDevice::GrabTransition

この列挙型は、あるオブジェクト(おそらくnullptr )から別のオブジェクト(おそらくnullptr )への排他的または受動的なグラブの遷移を表す。これはQPointingDevice::grabChanged() シグナルの引数として発行される。

有効な値は

定数説明
QPointingDevice::GrabExclusive0x10QPointerEvent::setExclusiveGrabber() の後に発せられる。
QPointingDevice::UngrabExclusive0x20グラバがnullptr に設定されているとき、QPointerEvent::setExclusiveGrabber() の後に発せられ、グラブが正常に終了したことを通知する。
QPointingDevice::CancelGrabExclusive0x30QPointerEvent::setExclusiveGrabber() の後に、グラボが別のオブジェクトに設定された場合に発せられ、古いグラボのグラボが「盗まれた」ことを通知する。
QPointingDevice::GrabPassive0x01QPointerEvent::addPassiveGrabber() の後に発せられる。
QPointingDevice::UngrabPassive0x02QPointerEvent::removePassiveGrabber() の後など、パッシブグラブが正常に終了したときに発せられる。
QPointingDevice::CancelGrabPassive0x03パッシブグラブが異常終了した時(ジェスチャーがキャンセルされた時)に発せられる。
QPointingDevice::OverrideGrabPassive0x04この値は現在使用されていません。

enum class QPointingDevice::PointerType
flags QPointingDevice::PointerTypes

この列挙型は、ポインティングデバイスと相互作用するものを表します。

このプロパティとQInputDevice::DeviceType の間には冗長性があります。例えば、タッチスクリーンを使用する場合、DeviceTypeTouchScreen で、PointerTypeFinger です(常に)。しかし、グラフィック・タブレットでは、スタイラスの両端が使用されることがよくあり、プログラムはそれらを区別する必要があります。そのため、この概念を拡張して、すべてのQPointerEvent に PointerType を持たせ、DeviceType を無視して PointerType だけで異なる反応をするようにすると、イベント処理コードを簡略化できます。

有効な値は以下の通りです:

定数説明
QPointingDevice::PointerType::Unknown0ポインタタイプが不明。
QPointingDevice::PointerType::Generic0x0001マウスまたはマウスのように動作するもの(X11のコアポインタ)。
QPointingDevice::PointerType::Finger0x0002ユーザの指。
QPointingDevice::PointerType::Pen0x0004スタイラスの描画端。
QPointingDevice::PointerType::Eraser0x0008スタイラスのもう一方の端(もう一方の端に仮想消しゴムがある場合)。
QPointingDevice::PointerType::Cursor0x0010Puck デバイスにあるような、十字線を持つ透明な円。
QPointingDevice::PointerType::AllPointerTypes0x7FFF上記のいずれか(デフォルトのフィルタ値として使用)。

PointerTypes型はQFlags<PointerType>のtypedefである。PointerType値のORの組み合わせを格納する。

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

QPointingDevice::QPointingDevice(QObject *parent = nullptr)

parent の子として新しい無効なポインティングデバイスのインスタンスを作成する。

QPointingDevice::QPointingDevice(const QString &name, qint64 id, QInputDevice::DeviceType deviceType, QPointingDevice::PointerType pointerType, QInputDevice::Capabilities capabilities, int maxPoints, int buttonCount, const QString &seatName = QString(), QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(), QObject *parent = nullptr)

与えられたname,deviceType,pointerType,capabilities,maxPoints,buttonCount,seatName,uniqueId,parent を持つ新しいポインティングデバイスのインスタンスを作成する。

int QPointingDevice::buttonCount() const

検出可能なデバイス上のボタンの最大数を返す。

注: プロパティ buttonCount のゲッター関数です。

[signal] void QPointingDevice::grabChanged(QObject *grabber, QPointingDevice::GrabTransition transition, const QPointerEvent *event, const QEventPoint &point) const

このシグナルは、event の配信中に、grabber オブジェクトがpoint の排他的または受動的なグラブを得たり失ったりしたときに発せられます。transition は、grabber オブジェクトから見て、何が起こったかを伝えます。

注: あるオブジェクトから別のオブジェクトへのグラブ遷移は、あるオブジェクトがグラブを失ったことを通知するシグナルと、別のグラブがあることを通知するシグナルの2つが発生します。grabber 引数がnullptr になることはありません。

QPointerEvent::setExclusiveGrabber(),QPointerEvent::addPassiveGrabber(),QPointerEvent::removePassiveGrabber()も参照

int QPointingDevice::maximumPoints() const

検出可能な同時タッチポイント(指)の最大数を返す。

注: プロパティmaximumPointsのゲッター関数です。

QPointingDevice::PointerType QPointingDevice::pointerType() const

ポインタ型を返す。

注: プロパティ pointerType のゲッター関数です。

[static] const QPointingDevice *QPointingDevice::primaryPointingDevice(const QString &seatName = QString())

指定された座席seatName のプライマリポインティングデバイス(コアポインタ、伝統的にはマウスと仮定)を返す。

複数のポインティングデバイスが登録されている場合、この関数は指定されたseatName に一致し、他のデバイスを親デバイスとして持たないマウスまたはタッチパッドを優先します。通常、親デバイスを持たないマスターデバイスまたはコアデバイスは1つだけです。しかし、そのようなデバイスが見つからない場合、この関数は新しい仮想「コアポインタ」マウスを作成します。このようにして Qt は、まだ入力デバイスの発見と登録を行っていないプラットフォームでも動作し続けます。

QPointingDeviceUniqueId QPointingDevice::uniqueId() const

デバイスのユニークID(実用性は疑わしい)を返す。

むしろQPointerEventPoint::uniqueId()の方を気にするべきかもしれません。

注: uniqueIdプロパティのゲッター関数。

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