KDStateMachineEditor API Documentation 2.3
Loading...
Searching...
No Matches
state.h
Go to the documentation of this file.
1/*
2 This file is part of the KDAB State Machine Editor Library.
3
4 SPDX-FileCopyrightText: 2014 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: Kevin Funk <kevin.funk@kdab.com>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LicenseRef-KDAB-KDStateMachineEditor
8
9 Licensees holding valid commercial KDAB State Machine Editor Library
10 licenses may use this file in accordance with the KDAB State Machine Editor
11 Library License Agreement provided with the Software.
12
13 Contact info@kdab.com if any conditions of this licensing are not clear to you.
14*/
15
16#ifndef KDSME_MODEL_STATE_H
17#define KDSME_MODEL_STATE_H
18
19#include "element.h"
20
21namespace KDSME {
22
24class Transition;
27
28class KDSME_CORE_EXPORT State : public Element
29{
30 Q_OBJECT
31 Q_PROPERTY(QString onEntry READ onEntry WRITE setOnEntry NOTIFY onEntryChanged FINAL)
32 Q_PROPERTY(QString onExit READ onExit WRITE setOnExit NOTIFY onExitChanged FINAL)
33 Q_PROPERTY(ChildMode childMode READ childMode WRITE setChildMode NOTIFY childModeChanged FINAL)
34 Q_PROPERTY(bool isComposite READ isComposite NOTIFY isCompositeChanged FINAL)
35 Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded NOTIFY expandedChanged FINAL)
36
37public:
43 Q_ENUM(ChildMode)
44
45 explicit State(State *parent = nullptr);
46 ~State();
47
48 Type type() const override;
49
50 Q_INVOKABLE KDSME::State *parentState() const;
51
52 State *initialState() const;
53 void setInitialState(State *initialState);
54
55 QList<State *> childStates() const;
56
57 QList<Transition *> transitions() const;
58 void addTransition(Transition *transition);
59 SignalTransition *addSignalTransition(State *target, const QString &silgnal = QString());
60 TimeoutTransition *addTimeoutTransition(State *target, int timeout);
61
65 QString onEntry() const;
66 void setOnEntry(const QString &onEntry);
67
71 QString onExit() const;
72 void setOnExit(const QString &onExit);
73
74 ChildMode childMode() const;
75 void setChildMode(ChildMode childMode);
76
80 bool isComposite() const;
81
82 bool isExpanded() const;
83 void setExpanded(bool expanded);
84
85 Q_INVOKABLE KDSME::StateMachine *machine() const;
86
87protected:
88 bool event(QEvent *event) override;
89
90Q_SIGNALS:
91 void onEntryChanged(const QString &onEntry);
92 void onExitChanged(const QString &onExit);
96
97private:
98 struct Private;
99 QScopedPointer<Private> d;
100};
101
102class KDSME_CORE_EXPORT HistoryState : public State
103{
104 Q_OBJECT
107
108public:
114 Q_ENUM(HistoryType)
115
116 explicit HistoryState(State *parent = nullptr);
117 explicit HistoryState(HistoryType type, State *parent = nullptr);
119
120 Type type() const override;
121 QString toDisplayString() const override;
122
123 State *defaultState() const;
124 void setDefaultState(State *state);
125
126 HistoryType historyType() const;
127 void setHistoryType(HistoryType historyType);
128
129Q_SIGNALS:
132
133private:
134 struct Private;
135 QScopedPointer<Private> d;
136};
137
138KDSME_CORE_EXPORT QDebug operator<<(QDebug dbg, const State *state);
139
140class KDSME_CORE_EXPORT FinalState : public State
141{
142 Q_OBJECT
143
144public:
145 explicit FinalState(State *parent = nullptr);
146 ~FinalState();
147
148 Type type() const override;
149
150private:
151 struct Private;
152 QScopedPointer<Private> d;
153};
154
155class KDSME_CORE_EXPORT StateMachine : public State
156{
157 Q_OBJECT
159
160public:
161 explicit StateMachine(QObject *parent = nullptr);
163
164 Type type() const override;
165
168
169Q_SIGNALS:
171
172private:
173 struct Private;
174 QScopedPointer<Private> d;
175};
176
177class KDSME_CORE_EXPORT PseudoState : public State
178{
179 Q_OBJECT
180 Q_PROPERTY(Kind kind READ kind WRITE setKind NOTIFY kindChanged FINAL)
181
182public:
183 enum Kind
184 {
186 };
187 Q_ENUM(Kind)
188
189 explicit PseudoState(Kind kind = InitialState, State *parent = nullptr);
190 ~PseudoState();
191
192 Type type() const override;
193
194 Kind kind() const;
195 void setKind(Kind kind);
196
197 QString kindString() const;
198
199 QString toDisplayString() const override;
200
201Q_SIGNALS:
203
204private:
205 struct Private;
206 QScopedPointer<Private> d;
207};
208
209KDSME_CORE_EXPORT QDebug operator<<(QDebug dbg, const PseudoState *state);
210
211}
212
213Q_DECLARE_METATYPE(KDSME::PseudoState::Kind)
214
215#endif
Element(QObject *parent=nullptr)
Definition element.cpp:30
KDSME::Element * parent
Definition element.h:37
FinalState(State *parent=nullptr)
Definition state.cpp:333
Type type() const override
Definition state.cpp:343
HistoryState(State *parent=nullptr)
Definition state.cpp:274
KDSME::State * defaultState
Definition state.h:105
void defaultStateChanged(KDSME::State *state)
void setDefaultState(State *state)
Definition state.cpp:308
HistoryType historyType
Definition state.h:106
void setHistoryType(HistoryType historyType)
Definition state.cpp:321
PseudoState(Kind kind=InitialState, State *parent=nullptr)
Definition state.cpp:367
void kindChanged(KDSME::PseudoState::Kind kind)
void setKind(Kind kind)
Definition state.cpp:388
void setRuntimeController(RuntimeController *runtimeController)
Definition state.cpp:252
Type type() const override
Definition state.cpp:352
KDSME::RuntimeController * runtimeController
Definition state.h:158
void runtimeControllerChanged(KDSME::RuntimeController *runtimeController)
StateMachine(QObject *parent=nullptr)
Definition state.cpp:235
bool expanded
Definition state.h:35
void setOnExit(const QString &onExit)
Definition state.cpp:153
void setExpanded(bool expanded)
Definition state.cpp:186
void setOnEntry(const QString &onEntry)
Definition state.cpp:144
void onExitChanged(const QString &onExit)
ChildMode childMode
Definition state.h:33
bool isExpanded() const
Definition state.cpp:181
void childModeChanged(KDSME::State::ChildMode childMode)
void onEntryChanged(const QString &onEntry)
State(State *parent=nullptr)
Definition state.cpp:63
@ ExclusiveStates
Definition state.h:40
@ ParallelStates
Definition state.h:41
bool isComposite
Definition state.h:34
QString onExit
Definition state.h:32
void isCompositeChanged(bool isComposite)
void setChildMode(ChildMode childMode)
Definition state.cpp:167
void expandedChanged(bool expanded)
QString onEntry
Definition state.h:31
KDSME_CORE_EXPORT QDebug operator<<(QDebug dbg, const State *state)
Definition state.cpp:408

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDStateMachineEditor
Create Qt State Machine metacode using a graphical user interface
https://github.com/KDAB/KDStateMachineEditor
Generated on for KDStateMachineEditor API Documentation by doxygen 1.15.0