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
返回事件的类型。
© 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.