| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QKEYEVENTTRANSITION_H |
| 5 | #define QKEYEVENTTRANSITION_H |
| 6 | |
| 7 | #include <QtStateMachine/qeventtransition.h> |
| 8 | |
| 9 | QT_BEGIN_NAMESPACE |
| 10 | |
| 11 | class QKeyEventTransitionPrivate; |
| 12 | class Q_STATEMACHINE_EXPORT QKeyEventTransition : public QEventTransition |
| 13 | { |
| 14 | Q_OBJECT |
| 15 | Q_PROPERTY(int key READ key WRITE setKey BINDABLE bindableKey) |
| 16 | Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask |
| 17 | BINDABLE bindableModifierMask) |
| 18 | public: |
| 19 | QKeyEventTransition(QState *sourceState = nullptr); |
| 20 | QKeyEventTransition(QObject *object, QEvent::Type type, int key, |
| 21 | QState *sourceState = nullptr); |
| 22 | ~QKeyEventTransition(); |
| 23 | |
| 24 | int key() const; |
| 25 | void setKey(int key); |
| 26 | QBindable<int> bindableKey(); |
| 27 | |
| 28 | Qt::KeyboardModifiers modifierMask() const; |
| 29 | void setModifierMask(Qt::KeyboardModifiers modifiers); |
| 30 | QBindable<Qt::KeyboardModifiers> bindableModifierMask(); |
| 31 | |
| 32 | protected: |
| 33 | void onTransition(QEvent *event) override; |
| 34 | bool eventTest(QEvent *event) override; |
| 35 | |
| 36 | private: |
| 37 | Q_DISABLE_COPY(QKeyEventTransition) |
| 38 | Q_DECLARE_PRIVATE(QKeyEventTransition) |
| 39 | }; |
| 40 | |
| 41 | QT_END_NAMESPACE |
| 42 | |
| 43 | #endif |
| 44 |
