| 1 | // Copyright (C) 2020 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 QBASICKEYEVENTTRANSITION_P_H |
| 5 | #define QBASICKEYEVENTTRANSITION_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtGui/qevent.h> |
| 19 | #include <QtStateMachine/qabstracttransition.h> |
| 20 | #include <QtCore/private/qglobal_p.h> |
| 21 | #include <private/qstatemachineglobal_p.h> |
| 22 | |
| 23 | QT_REQUIRE_CONFIG(qeventtransition); |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | class QBasicKeyEventTransitionPrivate; |
| 28 | class Q_AUTOTEST_EXPORT QBasicKeyEventTransition : public QAbstractTransition |
| 29 | { |
| 30 | Q_OBJECT |
| 31 | public: |
| 32 | QBasicKeyEventTransition(QState *sourceState = nullptr); |
| 33 | QBasicKeyEventTransition(QEvent::Type type, int key, QState *sourceState = nullptr); |
| 34 | QBasicKeyEventTransition(QEvent::Type type, int key, |
| 35 | Qt::KeyboardModifiers modifierMask, |
| 36 | QState *sourceState = nullptr); |
| 37 | ~QBasicKeyEventTransition(); |
| 38 | |
| 39 | QEvent::Type eventType() const; |
| 40 | void setEventType(QEvent::Type type); |
| 41 | |
| 42 | int key() const; |
| 43 | void setKey(int key); |
| 44 | QBindable<int> bindableKey(); |
| 45 | |
| 46 | Qt::KeyboardModifiers modifierMask() const; |
| 47 | void setModifierMask(Qt::KeyboardModifiers modifiers); |
| 48 | QBindable<Qt::KeyboardModifiers> bindableModifierMask(); |
| 49 | |
| 50 | protected: |
| 51 | bool eventTest(QEvent *event) override; |
| 52 | void onTransition(QEvent *) override; |
| 53 | |
| 54 | private: |
| 55 | Q_DISABLE_COPY_MOVE(QBasicKeyEventTransition) |
| 56 | Q_DECLARE_PRIVATE(QBasicKeyEventTransition) |
| 57 | }; |
| 58 | |
| 59 | QT_END_NAMESPACE |
| 60 | |
| 61 | #endif |
| 62 | |