このページでは

QInputEvent Class

QInputEvent クラスは、ユーザー入力を表すイベントの基底クラスです。詳細...

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

QContextMenuEvent、QKeyEvent 、およびQPointerEvent

パブリック関数

(since 6.0) const QInputDevice *device() const
QInputDevice::DeviceType deviceType() const
Qt::KeyboardModifiers modifiers() const
quint64 timestamp() const

プロテクトされた関数

QInputEvent(QInputEvent &&)
QInputEvent &operator=(QInputEvent &&)
QInputEvent &operator=(const QInputEvent &other)

詳細な説明

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

[protected delete] QInputEvent::QInputEvent(QInputEvent &&)

QInputEvent のインスタンスをmove-constructで生成します。この関数は削除されています。

[since 6.0] const QInputDevice *QInputEvent::device() const

元のイベントを生成したソースデバイスを返します。

合成イベント(たとえば、タッチイベントから生成されたマウスイベントなど)の場合、device() は引き続きタッチスクリーンデバイスを返すため、それが実際のマウスから発生したものではないことがわかります。したがって、mouseEvent.source()->type() != QInputDevice::DeviceType::Mouse は、Qt 5 の式mouseEvent.source() == Qt::MouseEventSynthesizedByQt の代替として使用できるものです。

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

QPointerEvent::pointingDevice()も参照してください 。

QInputDevice::DeviceType QInputEvent::deviceType() const

イベントを発生させたデバイスの型を返します。

Qt::KeyboardModifiers QInputEvent::modifiers() const

イベントが発生する直前に存在していたキーボード修飾フラグを返します。

QGuiApplication::keyboardModifiers()も参照してください 。

quint64 QInputEvent::timestamp() const

このイベントに対するウィンドウシステムのタイムスタンプを返します。通常、これはシステムの起動時刻など、任意の時点からの経過時間をミリ秒単位で表したものです。

[protected delete] QInputEvent &QInputEvent::operator=(QInputEvent &&)

other をこのQInputEvent インスタンスに移動・割り当てます。この関数は削除されます。

[noexcept protected default] QInputEvent &QInputEvent::operator=(const QInputEvent &other)

other をこのQInputEvent インスタンスにコピーして割り当てます。

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