QKeyEvent 类

class Qt3DInput ::QKeyEvent

QKeyEvent event type send by KeyBoardHandler. 更多...

头: #include < QKeyEvent >
CMake: find_package(Qt6 COMPONENTS 3dinput REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::3dinput)
qmake: QT += 3dinput
Since: Qt 5.5
实例化: 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
  QKeyEventPtr

详细描述

特性文档编制

accepted : bool

设置 accepted to true prevents the key event from being propagated to the item's parent.

Generally, if the item acts on the key event then it should be accepted so that ancestor items do not also respond to the same event.

访问函数:

bool isAccepted () const
void setAccepted (bool accepted )

[read-only] count : const int

Holds the number of keys involved in this event. If text is not empty, this is simply the length of the string.

访问函数:

int count () const

[read-only] isAutoRepeat : const bool

Holds whether this event comes from an auto-repeating key.

访问函数:

bool isAutoRepeat () const

[read-only] key : const int

This property holds the code of the key that was pressed or released.

Qt.Key for the list of keyboard codes.

另请参阅 QKeyEvent::key ().

访问函数:

int key () const

[read-only] modifiers : const int

This property holds the keyboard modifier flags that existed immediately before the event occurred.

另请参阅 QKeyEvent::modifiers ().

访问函数:

int modifiers () const

[read-only] nativeScanCode : const quint32

This property contains the native scan code of the key that was pressed. It is passed through from QKeyEvent unchanged.

访问函数:

quint32 nativeScanCode () const

[read-only] text : const QString

This property holds the Unicode text that the key generated. The text returned can be an empty string in cases where modifier keys, such as Shift, Control, Alt, and Meta, are being pressed or released. In such cases key will contain a valid value.

访问函数:

QString text () const

成员函数文档编制

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

返回 true if the key event matches the given standard key key_ ;否则返回 false .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 QKeySequence::StandardKey .

QEvent::Type QKeyEvent:: type () const

Returns the type of the event.

相关非成员

QKeyEventPtr

共享指针为 QKeyEvent .