QKeyEvent 類

class Qt3DInput ::QKeyEvent

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

頭: #include < QKeyEvent >
qmake: QT += 3dinput
Since: Qt 5.5
實例化: KeyEvent
繼承: QObject

該類在 Qt 5.5 引入。

特性

公共函數

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
typedef 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 )

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

isAutoRepeat : const bool

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

訪問函數:

bool isAutoRepeat () const

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

modifiers : const int

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

另請參閱 QKeyEvent::modifiers ().

訪問函數:

int modifiers () const

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

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

成員函數文檔編製

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.

相關非成員

typedef QKeyEventPtr

共享指針為 QKeyEvent .