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 QABSTRACTSTATE_P_H |
5 | #define QABSTRACTSTATE_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 <private/qobject_p.h> |
19 | #include <QtStateMachine/qabstractstate.h> |
20 | |
21 | QT_REQUIRE_CONFIG(statemachine); |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | class QStateMachine; |
26 | |
27 | class QState; |
28 | class QAbstractStatePrivate : public QObjectPrivate |
29 | { |
30 | Q_DECLARE_PUBLIC(QAbstractState) |
31 | |
32 | public: |
33 | enum StateType { |
34 | AbstractState, |
35 | StandardState, |
36 | FinalState, |
37 | HistoryState |
38 | }; |
39 | |
40 | QAbstractStatePrivate(StateType type); |
41 | |
42 | static QAbstractStatePrivate *get(QAbstractState *q) |
43 | { return q->d_func(); } |
44 | static const QAbstractStatePrivate *get(const QAbstractState *q) |
45 | { return q->d_func(); } |
46 | |
47 | QStateMachine *machine() const; |
48 | |
49 | void callOnEntry(QEvent *e); |
50 | void callOnExit(QEvent *e); |
51 | |
52 | void emitEntered(); |
53 | void emitExited(); |
54 | |
55 | quint16 stateType; |
56 | bool isMachine; |
57 | |
58 | void activeChanged() |
59 | { |
60 | emit q_func()->activeChanged(active: active.value()); |
61 | } |
62 | Q_OBJECT_BINDABLE_PROPERTY(QAbstractStatePrivate, bool, active, |
63 | &QAbstractStatePrivate::activeChanged); |
64 | |
65 | mutable QState *parentState; |
66 | }; |
67 | |
68 | QT_END_NAMESPACE |
69 | |
70 | #endif // QABSTRACTSTATE_P_H |
71 |