KDStateMachineEditor API Documentation  1.2
transition.h
1 /*
2  This file is part of the KDAB State Machine Editor Library.
3 
4  SPDX-FileCopyrightText: 2014-2021 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_TRANSITION_H
17 #define KDSME_MODEL_TRANSITION_H
18 
19 #include "element.h"
20 
21 namespace KDSME {
22 
23 class KDSME_CORE_EXPORT Transition : public Element
24 {
25  Q_OBJECT
26  Q_PROPERTY(KDSME::State* sourceState READ sourceState WRITE setSourceState NOTIFY sourceStateChanged FINAL)
27  Q_PROPERTY(KDSME::State* targetState READ targetState WRITE setTargetState NOTIFY targetStateChanged FINAL)
28  Q_PROPERTY(QString guard READ guard WRITE setGuard NOTIFY guardChanged FINAL)
30  Q_PROPERTY(QPainterPath shape READ shape WRITE setShape NOTIFY shapeChanged FINAL)
31  Q_PROPERTY(QRectF labelBoundingRect READ labelBoundingRect WRITE setLabelBoundingRect NOTIFY labelBoundingRectChanged FINAL)
32 
33 public:
34  explicit Transition(State* sourceState = nullptr);
35  ~Transition();
36 
37  Q_INVOKABLE KDSME::StateMachine* machine() const;
38 
39  State* sourceState() const;
40  void setSourceState(State* sourceState);
41 
42  State* targetState() const;
43  void setTargetState(State* targetState);
44 
45  Type type() const override;
46 
52  QString guard() const;
53  void setGuard(const QString& guard);
54 
55  QPainterPath shape() const;
56  void setShape(const QPainterPath& shape);
57 
58  QRectF labelBoundingRect() const;
59  void setLabelBoundingRect(const QRectF& rect);
60 
61 Q_SIGNALS:
62  void sourceStateChanged(State* sourceState);
63  void targetStateChanged(State* targetState);
64  void guardChanged(const QString& guard);
65  void shapeChanged(const QPainterPath& path);
66  void labelBoundingRectChanged(const QRectF& rect);
67 
68 private:
69  struct Private;
71 };
72 
73 KDSME_CORE_EXPORT QDebug operator<<(QDebug dbg, const Transition* transition);
74 
75 class KDSME_CORE_EXPORT SignalTransition : public Transition
76 {
77  Q_OBJECT
78  Q_PROPERTY(QString signal READ signal WRITE setSignal NOTIFY signalChanged)
79 
80 public:
81  explicit SignalTransition(State* sourceState);
83 
84  Type type() const override;
85 
86  QString signal() const;
87  void setSignal(const QString& signal);
88 
89 Q_SIGNALS:
90  void signalChanged(const QString& signal);
91 
92 private:
93  struct Private;
95 };
96 
97 class KDSME_CORE_EXPORT TimeoutTransition : public Transition
98 {
99  Q_OBJECT
100  Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged)
101 
102 public:
103  explicit TimeoutTransition(State* sourceState);
105 
106  Type type() const override;
107 
108  int timeout() const;
109  void setTimeout(int timeout);
110 
111 Q_SIGNALS:
112  void timeoutChanged(int timeout);
113 
114 private:
115  struct Private;
117 };
118 
119 }
120 
121 #endif
QPainterPath
KDSME::Transition
Definition: transition.h:24
KDSME::TimeoutTransition
Definition: transition.h:98
QDebug
KDSME::StateMachine
Definition: state.h:154
QString
QScopedPointer< Private >
KDSME::SignalTransition
Definition: transition.h:76
QRectF
KDSME::Element
Definition: element.h:35
KDSME::State
Definition: state.h:29

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