QKeyEvent

QKeyEvent event type send by KeyBoardHandler. More

Synopsis

Functions

Detailed Description

Contains parameters that describe a key event

class PySide2.Qt3DInput.QKeyEvent(type, key, modifiers[, text=""[, autorep=false[, count=1]]])
Parameters
  • typeType

  • modifiersKeyboardModifiers

  • autorep – bool

  • countushort

  • text – str

  • key – int

PySide2.Qt3DInput.QKeyEvent.count()
Return type

int

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

PySide2.Qt3DInput.QKeyEvent.isAccepted()
Return type

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.

PySide2.Qt3DInput.QKeyEvent.isAutoRepeat()
Return type

bool

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

PySide2.Qt3DInput.QKeyEvent.key()
Return type

int

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

See Key for the list of keyboard codes.

See also key() .

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

PySide2.Qt3DInput.QKeyEvent.modifiers()
Return type

int

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

See also modifiers() .

PySide2.Qt3DInput.QKeyEvent.nativeScanCode()
Return type

int

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

PySide2.Qt3DInput.QKeyEvent.setAccepted(accepted)
Parameters

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.

PySide2.Qt3DInput.QKeyEvent.text()
Return type

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.

PySide2.Qt3DInput.QKeyEvent.type()
Return type

Type

Returns the type of the event.