class QKeyEvent

QKeyEvent event type send by KeyBoardHandler. More

Inheritance diagram of PySide6.Qt3DInput.Qt3DInput.QKeyEvent

Synopsis

Properties

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

Contains parameters that describe a key event

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

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

Access functions:
property countᅟ: int

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

Access functions:
property isAutoRepeatᅟ: bool

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

Access functions:
property keyᅟ: 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 QKeyEvent::key().

Access functions:
property modifiersᅟ: int

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

See also QKeyEvent::modifiers().

Access functions:
property nativeScanCodeᅟ: int

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

Access functions:
property textᅟ: str

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.

Access functions:
__init__(ke)
Parameters:

keQKeyEvent

__init__(type, key, modifiers[, text=""[, autorep=false[, count=1]]])
Parameters:
  • typeType

  • key – int

  • modifiers – Combination of KeyboardModifier

  • text – str

  • autorep – bool

  • count – int

count()
Return type:

int

Getter of property countᅟ .

isAccepted()
Return type:

bool

Getter of property acceptedᅟ .

isAutoRepeat()
Return type:

bool

Getter of property isAutoRepeatᅟ .

key()
Return type:

int

Getter of property keyᅟ .

matches(key_)
Parameters:

keyStandardKey

Return type:

bool

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

See also

StandardKey

modifiers()
Return type:

int

Getter of property modifiersᅟ .

nativeScanCode()
Return type:

int

Getter of property nativeScanCodeᅟ .

setAccepted(accepted)
Parameters:

accepted – bool

See also

isAccepted()

Setter of property acceptedᅟ .

text()
Return type:

str

Getter of property textᅟ .

type()
Return type:

Type

Returns the type of the event.