KeyEvent QML Type

Provides information about a key event. 更多...

导入语句: import QtQuick .
Since: Qt Quick Ultralite 1.3



For example, the following changes the Item's state property when the Enter key is pressed:

Item {
    Keys.onPressed: { if (event.key == Qt.Key_Enter) state = 'ShowDetails'; }

注意: This event provides only basic information about the key code, without any key modifiers or other

另请参阅 .


key : int

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

Qt::Key for the list of keyboard codes.

注意: This property does not distinguish between capital and non-capital letters.

nativeScanCode : uint32_t

This property contains the native scan code of the key that was pressed.