KeyEvent QML Type

QKeyEvent C++ 类的 QML 前端。更多

Import Statement: import Qt3D.Input 2.9
In C++: QKeyEvent
Status: Deprecated

属性

方法

详细说明

KeyEvent QML 类型不能直接创建。该类型的对象在KeyboardHandler 中用作信号参数。

属性文档

accepted : bool

accepted设置为true 会阻止 key 事件传播到项目的父节点。

一般情况下,如果项目对按键事件做出反应,则应接受该事件,以免祖先项目也对同一事件做出反应。


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


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