KeyEvent QML Type
| Import Statement: | import Qt3D.Input 2.11 |
| In C++: | QKeyEvent |
| Status: | Deprecated |
属性
- accepted : bool
- count : int
- isAutoRepeat : bool
- key : int
- modifiers : int
- nativeScanCode : quint32
- text : string
方法
- bool matches(StandardKey key)
详细说明
KeyEvent QML 类型不能直接创建。该类型的对象在KeyboardHandler 中用作信号参数。
属性文档
accepted : bool
将accepted设置为true 可以防止键事件传播到项的父项。
一般来说,如果项目对按键事件做出反应,则应接受该事件,以免父项目也对同一事件做出反应。
count : int [read-only]
表示该事件涉及的键的个数。如果text 不为空,则为字符串的长度。
isAutoRepeat : bool [read-only]
表示该事件是否来自自动重复按键。
key : int [read-only]
该属性包含按下或松开的键的代码。
键盘代码列表请参见Qt.Key 。
另请参见 KeyEvent.key 。
modifiers : int [read-only]
该属性保存事件发生前的键盘修改器标记。
另请参阅 KeyEvent.modifiers 。
nativeScanCode : quint32 [read-only]
该属性包含按下的按键的本地扫描代码。它将原封不动地从QKeyEvent 传递过来。
另请参阅 QKeyEvent::nativeScanCode().
text : string [read-only]
该属性包含按键生成的 Unicode 文本。在按下或释放 Shift、Control、Alt 和 Meta 等修改键时,返回的文本可能是空字符串。在这种情况下,key 将包含一个有效值。
方法文档
bool matches(StandardKey key)
如果关键事件符合给定的标准key ,则返回true ;否则返回false 。
另请参见 QKeySequence::StandardKey 。
© 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.