| 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_REQUIRE_CONFIG(qeventtransition); | 
| 10 | |
| 11 | QT_BEGIN_NAMESPACE | 
| 12 | |
| 13 | class QKeyEventTransitionPrivate; | 
| 14 | class Q_STATEMACHINE_EXPORT QKeyEventTransition : public QEventTransition | 
| 15 | { | 
| 16 | Q_OBJECT | 
| 17 | Q_PROPERTY(int key READ key WRITE setKey BINDABLE bindableKey) | 
| 18 | Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask | 
| 19 | BINDABLE bindableModifierMask) | 
| 20 | public: | 
| 21 | QKeyEventTransition(QState *sourceState = nullptr); | 
| 22 | QKeyEventTransition(QObject *object, QEvent::Type type, int key, | 
| 23 | QState *sourceState = nullptr); | 
| 24 | ~QKeyEventTransition(); | 
| 25 | |
| 26 | int key() const; | 
| 27 | void setKey(int key); | 
| 28 | QBindable<int> bindableKey(); | 
| 29 | |
| 30 | Qt::KeyboardModifiers modifierMask() const; | 
| 31 | void setModifierMask(Qt::KeyboardModifiers modifiers); | 
| 32 | QBindable<Qt::KeyboardModifiers> bindableModifierMask(); | 
| 33 | |
| 34 | protected: | 
| 35 | void onTransition(QEvent *event) override; | 
| 36 | bool eventTest(QEvent *event) override; | 
| 37 | |
| 38 | private: | 
| 39 | Q_DISABLE_COPY(QKeyEventTransition) | 
| 40 | Q_DECLARE_PRIVATE(QKeyEventTransition) | 
| 41 | }; | 
| 42 | |
| 43 | QT_END_NAMESPACE | 
| 44 | |
| 45 | #endif | 
| 46 | 
