QKeyEvent#

QKeyEvent event type send by KeyBoardHandler. More

Inheritance diagram of PySide6.Qt3DInput.Qt3DInput.QKeyEvent

Synopsis#

Properties#

Functions#

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

class PySide6.Qt3DInput.Qt3DInput.QKeyEvent(type, key, modifiers[, text=""[, autorep=false[, count=1]]])#

PySide6.Qt3DInput.Qt3DInput.QKeyEvent(ke)

Parameters:

Note

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

property PᅟySide6.Qt3DInput.Qt3DInput.QKeyEvent.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 PᅟySide6.Qt3DInput.Qt3DInput.QKeyEvent.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 PᅟySide6.Qt3DInput.Qt3DInput.QKeyEvent.isAutoRepeat: bool#

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

Access functions:
property PᅟySide6.Qt3DInput.Qt3DInput.QKeyEvent.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 PᅟySide6.Qt3DInput.Qt3DInput.QKeyEvent.modifiers: int#

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

See also QKeyEvent::modifiers().

Access functions:
property PᅟySide6.Qt3DInput.Qt3DInput.QKeyEvent.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 PᅟySide6.Qt3DInput.Qt3DInput.QKeyEvent.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:
PySide6.Qt3DInput.Qt3DInput.QKeyEvent.count()#
Return type:

int

Getter of property count .

PySide6.Qt3DInput.Qt3DInput.QKeyEvent.isAccepted()#
Return type:

bool

Getter of property accepted .

PySide6.Qt3DInput.Qt3DInput.QKeyEvent.isAutoRepeat()#
Return type:

bool

Getter of property isAutoRepeat .

PySide6.Qt3DInput.Qt3DInput.QKeyEvent.key()#
Return type:

int

Getter of property key .

PySide6.Qt3DInput.Qt3DInput.QKeyEvent.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

PySide6.Qt3DInput.Qt3DInput.QKeyEvent.modifiers()#
Return type:

int

Getter of property modifiers .

PySide6.Qt3DInput.Qt3DInput.QKeyEvent.nativeScanCode()#
Return type:

int

Getter of property nativeScanCode .

PySide6.Qt3DInput.Qt3DInput.QKeyEvent.setAccepted(accepted)#
Parameters:

accepted – bool

See also

isAccepted()

Setter of property accepted .

PySide6.Qt3DInput.Qt3DInput.QKeyEvent.text()#
Return type:

str

Getter of property text .

PySide6.Qt3DInput.Qt3DInput.QKeyEvent.type()#
Return type:

Type

Returns the type of the event.