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_H
5#define QABSTRACTSTATE_H
6
7#include <QtCore/qobject.h>
8#include <QtStateMachine/qstatemachineglobal.h>
9
10QT_REQUIRE_CONFIG(statemachine);
11
12QT_BEGIN_NAMESPACE
13
14class QState;
15class QStateMachine;
16
17class QAbstractStatePrivate;
18class Q_STATEMACHINE_EXPORT QAbstractState : public QObject
19{
20 Q_OBJECT
21 Q_PROPERTY(bool active READ active NOTIFY activeChanged BINDABLE bindableActive)
22public:
23 ~QAbstractState();
24
25 QState *parentState() const;
26 QStateMachine *machine() const;
27
28 bool active() const;
29 QBindable<bool> bindableActive();
30
31Q_SIGNALS:
32 void entered(QPrivateSignal);
33 void exited(QPrivateSignal);
34 void activeChanged(bool active);
35
36protected:
37 QAbstractState(QState *parent = nullptr);
38
39 virtual void onEntry(QEvent *event) = 0;
40 virtual void onExit(QEvent *event) = 0;
41
42 bool event(QEvent *e) override;
43
44protected:
45 QAbstractState(QAbstractStatePrivate &dd, QState *parent);
46
47private:
48 Q_DISABLE_COPY(QAbstractState)
49 Q_DECLARE_PRIVATE(QAbstractState)
50};
51
52QT_END_NAMESPACE
53
54#endif
55

source code of qtscxml/src/statemachine/qabstractstate.h