QKeyEvent Class

(Qt3DInput::QKeyEvent)

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

头文件: #include <QKeyEvent>
qmake: QT += 3dinput
开始支持版本: Qt 5.5
Instantiated By: KeyEvent
基类: QObject

属性

公有函数

QKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text = QString(), bool autorep = false, ushort count = 1)
QKeyEvent(const QKeyEvent &ke)
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
  • 32 个公有函数继承自 QObject
typedef QKeyEventPtr

其他继承的成员

  • 1 个公有槽函数继承自 QObject
  • 2 个信号继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 9 个受保护的函数继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

QKeyEvent event type send by KeyBoardHandler.

Contains parameters that describe a key event

属性

accepted : bool

Setting 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.

See Qt.Key for the list of keyboard codes.

访问函数:

int key() const

参见 QKeyEvent::key.

modifiers : const int

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

访问函数:

int modifiers() const

参见 QKeyEvent::modifiers.

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

成员函数

QKeyEvent::QKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text = QString(), bool autorep = false, ushort count = 1)

Default constructs an instance of QKeyEvent.

QKeyEvent::QKeyEvent(const QKeyEvent &ke)

Copy constructor.

bool QKeyEvent::matches(QKeySequence::StandardKey key_) const

Returns true if the key event matches the given standard key key_; otherwise returns false.

参见 QKeySequence::StandardKey.

QEvent::Type QKeyEvent::type() const

Returns the type of event

相关非成员

typedef Qt3DInput::QKeyEventPtr

A shared pointer for QKeyEvent.