- Qt 6.10
- Qt State Machine
- C++ Classes
- QKeyEventTransition
- Qt 6.10.3 Reference Documentation

# QKeyEventTransition Class

The QKeyEventTransition class provides a transition for key events. More...

Header: | `#include <QKeyEventTransition>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS StateMachine)` `target_link_libraries(mytarget PRIVATE Qt6::StateMachine)`
qmake: | `QT += statemachine`
Inherits: | QEventTransition

- List of all members, including inherited members

## Properties

- key : int
- modifierMask : Qt::KeyboardModifiers

## Public Functions

| QKeyEventTransition(QState *sourceState = nullptr)
| QKeyEventTransition(QObject *object, QEvent::Type type, int key, QState *sourceState = nullptr)
virtual | ~QKeyEventTransition()
QBindable<int> | bindableKey()
QBindable<Qt::KeyboardModifiers> | bindableModifierMask()
int | key() const
Qt::KeyboardModifiers | modifierMask() const
void | setKey(int key)
void | setModifierMask(Qt::KeyboardModifiers modifierMask)

## Reimplemented Protected Functions

virtual bool | eventTest(QEvent *event) override
virtual void | onTransition(QEvent *event) override

## Detailed Description

QKeyEventTransition is part of Qt State Machine Framework.

See also QState::addTransition().

## Property Documentation

### `[bindable]` key : int

Note: This property supports QProperty bindings.

This property holds the key that this key event transition is associated with

Access functions:

int | key() const
void | setKey(int key)

### `[bindable]` modifierMask : Qt::KeyboardModifiers

Note: This property supports QProperty bindings.

This property holds the keyboard modifier mask that this key event transition checks for

Access functions:

Qt::KeyboardModifiers | modifierMask() const
void | setModifierMask(Qt::KeyboardModifiers modifierMask)

## Member Function Documentation

### QKeyEventTransition::QKeyEventTransition(QState *sourceState = nullptr)

Constructs a new key event transition with the given sourceState.

### QKeyEventTransition::QKeyEventTransition(QObject *object, QEvent::Type type, int key, QState *sourceState = nullptr)

Constructs a new key event transition for events of the given type for the given object, with the given key and sourceState.

### `[virtual noexcept]` QKeyEventTransition::~QKeyEventTransition()

Destroys this key event transition.

### `[override virtual protected]` bool QKeyEventTransition::eventTest(QEvent *event)

Reimplements: QEventTransition::eventTest(QEvent *event).

### int QKeyEventTransition::key() const

Returns the key that this key event transition checks for.

Note: Getter function for property key.

See also setKey().

### Qt::KeyboardModifiers QKeyEventTransition::modifierMask() const

Returns the keyboard modifier mask that this key event transition checks for.

Note: Getter function for property modifierMask.

See also setModifierMask().

### `[override virtual protected]` void QKeyEventTransition::onTransition(QEvent *event)

Reimplements: QEventTransition::onTransition(QEvent *event).

### void QKeyEventTransition::setKey(int key)

Sets the key that this key event transition will check for.

Note: Setter function for property key.

See also key().

### void QKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask)

Sets the keyboard modifier mask that this key event transition will check for to modifierMask.

Note: Setter function for property modifierMask.

See also modifierMask().