このページでは

Qt3DInput::QKeyEvent Class

class Qt3DInput::QKeyEvent

KeyBoardHandler によって送信される QKeyEvent イベントタイプ。詳細...

ヘッダー: #include <QKeyEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3dinput)
target_link_libraries(mytarget PRIVATE Qt6::3dinput)
qmake: QT += 3dinput
QML内: KeyEvent
継承元: QObject
ステータス: 非推奨

このクラスは非推奨です。新しいコードでの使用は強く推奨しません。

プロパティ

公開関数

int count() const
bool isAccepted() const
bool isAutoRepeat() const
int key() const
bool matches(QKeySequence::StandardKey key_) const
int modifiers() const
quint32 nativeScanCode() const
void setAccepted(bool accepted)
QString text() const
QEvent::Type type() const

詳細な説明

プロパティのドキュメント

accepted : bool

「accepted」をtrue に設定すると、キーイベントがアイテムの親へ伝播されるのを防ぐことができます。

一般的に、アイテムがキーイベントに対して処理を行う場合は、そのイベントを受け入れるように設定すべきです。そうすることで、親アイテムが同じイベントに反応することを防ぐことができます。

アクセス関数:

bool isAccepted() const
void setAccepted(bool accepted)

[read-only] count : const int

このイベントに関与するキーの数を保持します。text が空でない場合、これは単にその文字列の長さとなります。

アクセス関数:

int count() const

[read-only] isAutoRepeat : const bool

このイベントが自動繰り返しキーから発生したかどうかを示します。

アクセス関数:

bool isAutoRepeat() const

[read-only] key : const int

このプロパティには、押された、または離されたキーのコードが格納されます。

キーボードコードの一覧については、Qt.Key を参照してください。

QKeyEvent::key()も参照してください。

アクセス関数:

int key() const

[read-only] modifiers : const int

このプロパティには、イベントが発生する直前に存在していたキーボード修飾フラグが格納されます。

QKeyEvent::modifiers()も参照してください。

アクセス関数:

int modifiers() const

[read-only] nativeScanCode : const quint32

このプロパティには、押されたキーのネイティブスキャンコードが含まれます。これはQKeyEvent から変更されることなく渡されます。

アクセス関数:

quint32 nativeScanCode() const

[read-only] text : const QString

このプロパティには、キーによって生成されたUnicodeテキストが格納されます。Shift、Control、Alt、Metaなどの修飾キーが押されている、または離されている場合、返されるテキストは空文字列になることがあります。そのような場合、key には有効な値が格納されます。

アクセス関数:

QString text() const

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

[invokable] bool QKeyEvent::matches(QKeySequence::StandardKey key_) const

キーイベントが指定された標準キーkey_ と一致する場合、true を返します。一致しない場合は、false を返します。

注:この関数は 、メタオブジェクトシステムを介して、および QML から呼び出すことができます。Q_INVOKABLE を参照してください。

QKeySequence::StandardKeyも参照してください 。

QEvent::Type QKeyEvent::type() const

イベントの型を返します。

関連する非メンバー

QKeyEventPtr

QKeyEvent 用の共有ポインタ。

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