- Qt 5.5
- Qt3D Module
- QML Types
- KeyEvent QML Type
- Qt 5.5.1 Reference Documentation

# KeyEvent QML Type

Import Statement: | import .
Since: | Qt 5.5
Instantiates: | Q3DKeyEvent

- List of all members, including inherited members

## Properties

- accepted : bool
- count : int
- isAutoRepeat : bool
- key : int
- modifiers : int
- nativeScanCodei : quint32
- text : string

## Methods

- bool matches(StandardKey key)

## Detailed Description

The KeyEvent QML type cannot be directly created. Objects of this type are used as signal parameters in KeyboardInput.

## Property Documentation

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.

read-onlycount : int

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

read-onlyisAutoRepeat : bool

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

read-onlykey : int

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

See Qt.Key for the list of keyboard codes.

See also KeyEvent.key.

read-onlymodifiers : int

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

See also KeyEvent.modifiers.

read-onlynativeScanCodei : quint32

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

See also QKeyEvent::nativeScanCode().

read-onlytext : string

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.

## Method Documentation

bool matches(StandardKey key)

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

See also QKeySequence::StandardKey.