KDStateMachineEditor API Documentation  1.2.9
A framework for creating Qt State Machine metacode using a graphical user interface
statemachineview.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_WIDGETS_STATEMACHINEVIEW_H
17 #define KDSME_WIDGETS_STATEMACHINEVIEW_H
18 
19 #include "kdsme_view_export.h"
20 
21 #include <QQuickWidget>
22 
23 namespace KDSME {
24 
25 class Command;
26 class EditController;
27 class CommandController;
28 class StateMachineScene;
29 class StateMachine;
30 class Element;
31 
39 class KDSME_VIEW_EXPORT StateMachineView : public QQuickWidget
40 {
41  Q_OBJECT
42  Q_PROPERTY(KDSME::StateMachineScene* scene READ scene WRITE setScene NOTIFY sceneChanged)
43  Q_PROPERTY(KDSME::CommandController* commandController READ commandController CONSTANT)
44  Q_PROPERTY(KDSME::EditController* editController READ editController CONSTANT)
45 
46  Q_PROPERTY(QString themeName READ themeName WRITE setThemeName NOTIFY themeNameChanged)
47 
48 public:
49  explicit StateMachineView(QWidget* parent = nullptr);
51 
52  StateMachineScene* scene() const;
53 
54  CommandController* commandController() const;
55  EditController* editController() const;
56 
57  QString defaultThemeName() const;
58  QString themeName() const;
59  void setThemeName(const QString& themeName);
60 
61  Q_INVOKABLE void sendCommand(KDSME::Command* cmd);
62 
63  Q_INVOKABLE void fitInView();
64 
65  Q_INVOKABLE void changeStateMachine(KDSME::StateMachine *stateMachine);
66  Q_INVOKABLE void deleteElement(KDSME::Element *element);
67 
68 protected:
69  QQuickItem* viewPortObject() const;
70  QQuickItem* sceneObject() const;
71 
72 Q_SIGNALS:
73  void sceneChanged(KDSME::StateMachineScene* scene);
74  void themeNameChanged(const QString& themeName);
75 
76 private:
77  struct Private;
79 
80  void setScene(StateMachineScene* scene);
81 
82  Q_PRIVATE_SLOT(d, void onStateMachineChanged(KDSME::StateMachine*))
83 };
84 
85 }
86 
93 #endif // STARTCHARTVIEW_H
Definition: state.h:153
Widget for displaying a KDSME::StateMachine in a Qt Quick based view.
Definition: statemachineview.h:39
Definition: commandcontroller.h:33
Definition: statemachinescene.h:34
Definition: element.h:34
Definition: editcontroller.h:27
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