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 |
- 継承されたメンバーを含むすべてのメンバーの一覧
- 非推奨のメンバ
- QPointingDevice はイベントクラスの一部です。
パブリック型
| enum | GrabTransition { GrabExclusive, UngrabExclusive, CancelGrabExclusive, GrabPassive, UngrabPassive, …, OverrideGrabPassive } |
| enum class | PointerType { Unknown, Generic, Finger, Pen, Eraser, …, AllPointerTypes } |
| flags | PointerTypes |
プロパティ
- buttonCount : const int
- maximumPoints : const int
- pointerType : const PointerType
- uniqueId : const QPointingDeviceUniqueId
パブリック関数
| 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()) |
保護された関数
| QPointingDevice(const QPointingDevice &) | |
| QPointingDevice(QPointingDevice &&) | |
| QPointingDevice & | operator=(QPointingDevice &&) |
| QPointingDevice & | operator=(const QPointingDevice &) |
詳細な説明
各QPointerEvent には、タイプや機能といったデバイス固有のプロパティにアクセスできるようにするためのQPointingDeviceポインタが含まれています。ポインタイベントを生成する前に、利用可能なポインティングデバイスをQWindowSystemInterface経由で登録するのは、プラットフォームまたは汎用プラグインの責任です。アプリケーションはこのクラスをインスタンス化する必要はなく、QPointerEvent::device()が指すグローバルインスタンスにアクセスするだけで済みます。
メンバ型のドキュメント
enum QPointingDevice::GrabTransition
この列挙型は、あるオブジェクト(nullptr である場合もある)から別のオブジェクト(nullptr である場合もある)への排他的または受動的なグラブの遷移を表します。これは、QPointingDevice::grabChanged() シグナルの引数として送信されます。
有効な値は以下の通りです:
| 定数 | 値 | 説明 |
|---|---|---|
QPointingDevice::GrabExclusive | 0x10 | QPointerEvent::setExclusiveGrabber() の後に発火します。 |
QPointingDevice::UngrabExclusive | 0x20 | グラバーが `nullptr` に設定されている場合、QPointerEvent::setExclusiveGrabber() の後に発火し、グラブが正常に終了したことを通知します。 |
QPointingDevice::CancelGrabExclusive | 0x30 | グラバーが別のオブジェクトに設定された後、QPointerEvent::setExclusiveGrabber() の後に発行され、以前のグラバーのグラブが「奪われた」ことを通知します。 |
QPointingDevice::GrabPassive | 0x01 | QPointerEvent::addPassiveGrabber() の後に発行されます。 |
QPointingDevice::UngrabPassive | 0x02 | パッシブグラブが正常に終了したとき(たとえば、QPointerEvent::removePassiveGrabber() の実行後など)に発行されます。 |
QPointingDevice::CancelGrabPassive | 0x03 | パッシブグラブが異常終了(ジェスチャーがキャンセルされた)されたときに発火します。 |
QPointingDevice::OverrideGrabPassive | 0x04 | この値は現在使用されていません。 |
enum class QPointingDevice::PointerType
flags QPointingDevice::PointerTypes
この列挙型は、ポインティングデバイスと相互作用している対象を表します。
このプロパティと `QInputDevice::DeviceType` との間には、ある程度の重複があります。たとえば、タッチスクリーンを使用する場合、`DeviceType ` は `TouchScreen ` となり、`PointerType ` は `Finger ` となります(常に)。しかし、グラフィックスタブレットでは、スタイラスの両端が使用されることが多く、プログラムはそれらを区別する必要があります。 そのため、この概念が拡張され、すべてのQPointerEvent にPointerTypeが割り当てられるようになりました。これにより、DeviceTypeを無視し、PointerTypeのみに基づいて異なる反応をするようにすることで、一部のイベント処理コードを簡略化できます。
有効な値は以下の通りです:
| 定数 | 値 | 説明 |
|---|---|---|
QPointingDevice::PointerType::Unknown | 0 | ポインタのタイプが不明です。 |
QPointingDevice::PointerType::Generic | 0x0001 | マウス、またはマウスのように振る舞うもの(X11におけるコアポインタ)。 |
QPointingDevice::PointerType::Finger | 0x0002 | ユーザーの指。 |
QPointingDevice::PointerType::Pen | 0x0004 | スタイラスの描画端。 |
QPointingDevice::PointerType::Eraser | 0x0008 | スタイラスのもう一方の端(その端に仮想の消しゴムがある場合)。 |
QPointingDevice::PointerType::Cursor | 0x0010 | Puck デバイスに見られるような、十字線付きの透明な円。 |
QPointingDevice::PointerType::Palm (since Qt 6.12) | 0x0020 | ユーザーの手のひら。 |
QPointingDevice::PointerType::AllPointerTypes | 0x7FFF | 上記のいずれか(デフォルトのフィルタ値として使用される)。 |
PointerTypes 型は、QFlags<PointerType> の typedef です。これは、PointerType 値の論理和(OR)を格納します。
プロパティのドキュメント
[read-only] buttonCount : const int
このプロパティは、検出可能なデバイス上のボタンの最大数を保持します
アクセス機能:
| int | buttonCount() const |
[read-only] maximumPoints : const int
このプロパティは、検出可能な同時タッチポイント(指)の最大数を保持します
アクセス機能:
| int | maximumPoints() const |
[read-only] pointerType : const PointerType
このプロパティはポインタ型を保持します
アクセス関数:
| QPointingDevice::PointerType | pointerType() const |
[read-only] uniqueId : const QPointingDeviceUniqueId
このプロパティには、デバイス一意のID(その有用性は疑問ですが)が格納されています
むしろ、QPointerEventPoint::uniqueId() に注目したほうがよいでしょう。
アクセス関数:
| QPointingDeviceUniqueId | uniqueId() const |
メンバ関数のドキュメント
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 を使用して、新しいポインティングデバイスのインスタンスを作成します。
[protected delete] QPointingDevice::QPointingDevice(const QPointingDevice &)
QPointingDevice のインスタンスをコピーして生成します。この関数は削除されています。
[protected delete] QPointingDevice::QPointingDevice(QPointingDevice &&)
QPointingDevice のインスタンスをMoveコンストラクタで生成します。この関数は削除されています。
int QPointingDevice::buttonCount() const
デバイス上で検出可能なボタンの最大数を返します。
注: プロパティ buttonCountのゲッター 関数です。
[signal] void QPointingDevice::grabChanged(QObject *grabber, QPointingDevice::GrabTransition transition, const QPointerEvent *event, const QEventPoint &point) const
このシグナルは、`grabber ` オブジェクトが、`event` の配信中に `point ` に対する排他的または受動的なグラブを獲得または喪失した際に発火します。`transition ` は、`grabber ` オブジェクトの観点から、何が発生したかを示します。
注: あるオブジェクトから別のオブジェクトへのグラブ遷移では 、一方のオブジェクトがグラブを失ったことを通知する信号と、別のグラバーが存在することを通知する信号の2つの信号が発生します。それ以外の場合、グラブ状態への遷移または非グラブ状態からの遷移時には、1つの信号のみが発信されます。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のゲッター 関数です。
[protected delete] QPointingDevice &QPointingDevice::operator=(QPointingDevice &&)
other をこのQPointingDevice インスタンスに割り当てます。この関数は削除されます。
[protected delete] QPointingDevice &QPointingDevice::operator=(const QPointingDevice &)
other をこのQPointingDevice インスタンスにコピー・割り当てします。この関数は削除されます。
© 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.