KDStateMachineEditor API Documentation  1.2.50
runtimecontroller.h
1 /*
2  This file is part of the KDAB State Machine Editor Library.
3 
4  SPDX-FileCopyrightText: 2015-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_RUNTIMECONTROLLER_H
17 #define KDSME_RUNTIMECONTROLLER_H
18 
19 #include "kdsme_core_export.h"
20 
21 #include <QObject>
22 #include <QRectF>
23 #include <QSet>
24 
25 namespace KDSME {
26 
27 class State;
28 class Transition;
29 
30 class KDSME_CORE_EXPORT RuntimeController : public QObject
31 {
32  Q_OBJECT
33  Q_PROPERTY(QSet<KDSME::State*> activeConfiguration READ activeConfiguration NOTIFY activeConfigurationChanged)
34  Q_PROPERTY(KDSME::Transition* lastTransition READ lastTransition NOTIFY lastTransitionChanged)
35  Q_PROPERTY(bool isRunning READ isRunning NOTIFY isRunningChanged)
36  Q_PROPERTY(QRectF activeRegion READ activeRegion NOTIFY activeRegionChanged)
37 
38 public:
40 
41  explicit RuntimeController(QObject* parent = nullptr);
43 
44  Configuration activeConfiguration() const;
45  QList<Configuration> lastConfigurations() const;
46  void setActiveConfiguration(const Configuration& configuration);
47 
48  QList<Transition*> lastTransitions() const;
49  Transition* lastTransition() const;
50  void setLastTransition(Transition* transition);
51 
52  bool isRunning() const;
53  void setIsRunning(bool isRunning);
54 
55  Q_INVOKABLE float activenessForState(KDSME::State* state) const;
56  Q_INVOKABLE float activenessForTransition(KDSME::Transition* transition);
57 
58  int historySize() const;
59  void setHistorySize(int size);
60 
61  QRectF activeRegion() const;
62 
63  void clear();
64 
65 Q_SIGNALS:
66  void activeConfigurationChanged(const QSet<State*>& configuration);
67  void lastTransitionChanged(Transition* transition);
68  void isRunningChanged(bool isRunning);
69  void activeRegionChanged(const QRectF& region);
70 
71 private:
72  struct Private;
74 };
75 
76 }
77 
78 #endif
Definition: state.h:28
Definition: transition.h:23
Definition: runtimecontroller.h:30
Definition: mainwindow.h:21

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