KDStateMachineEditor API Documentation 2.1
Loading...
Searching...
No Matches
statemachinescene.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
17#ifndef KDSME_VIEW_STATEMACHINESCENE_H
18#define KDSME_VIEW_STATEMACHINESCENE_H
19
20#include "kdsme_view_export.h"
21#include "abstractscene.h"
22
23#include <QObject>
24
25namespace KDSME {
26class Element;
27class Layouter;
28class LayoutProperties;
29class State;
30class StateMachine;
31class StateModel;
32class Transition;
33
34class KDSME_VIEW_EXPORT StateMachineScene : public AbstractScene
35{
36 Q_OBJECT
37 Q_PROPERTY(KDSME::State *rootState READ rootState WRITE setRootState NOTIFY rootStateChanged)
38 Q_PROPERTY(KDSME::Element *currentItem READ currentItem WRITE setCurrentItem NOTIFY currentItemChanged)
39 Q_PROPERTY(KDSME::LayoutProperties *layoutProperties READ layoutProperties CONSTANT)
40 Q_PROPERTY(qreal zoom READ zoom WRITE setZoom NOTIFY zoomChanged FINAL)
41 Q_PROPERTY(int maximumDepth READ maximumDepth WRITE setMaximumDepth NOTIFY maximumDepthChanged FINAL)
42
43public:
44 explicit StateMachineScene(QQuickItem *parent = nullptr);
46
47 StateModel *stateModel() const;
48 void setModel(QAbstractItemModel *model) override;
49
50 State *rootState() const;
51 void setRootState(State *rootState);
52
53 Layouter *layouter() const;
55 void setLayouter(Layouter *layouter);
56
57 qreal zoom() const;
58 void setZoom(qreal zoom);
59
60 void zoomBy(qreal scale);
61
62 int maximumDepth() const;
63 void setMaximumDepth(int maximumDepth);
64
65 LayoutProperties *layoutProperties() const;
66
67 Q_INVOKABLE void collapseItem(KDSME::State *state);
68 Q_INVOKABLE void expandItem(KDSME::State *state);
69 Q_INVOKABLE bool isItemExpanded(KDSME::State *state) const;
70 Q_INVOKABLE void setItemExpanded(KDSME::State *state, bool expand);
71
72 Q_INVOKABLE bool isItemSelected(KDSME::Element *item);
73 Q_INVOKABLE void setItemSelected(KDSME::Element *item, bool selected);
74
75 KDSME::Element *currentItem() const;
76 void setCurrentItem(KDSME::Element *item);
77
78 KDSME::Element *currentState() const;
79
80public Q_SLOTS:
81 void layout();
82
83Q_SIGNALS:
84 void stateMachineChanged(KDSME::StateMachine *stateMachine);
85 void rootStateChanged(KDSME::State *state);
86 void currentItemChanged(KDSME::Element *currentItem);
87 void zoomChanged(qreal zoom);
88 void maximumDepthChanged(int depth);
89
90protected Q_SLOTS:
91 void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
92
93 void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override;
94 void rowsInserted(const QModelIndex &parent, int start, int end) override;
95 void layoutChanged() override;
96
97private:
98 struct Private;
99 QScopedPointer<Private> d;
100};
101
102}
103
104Q_DECLARE_METATYPE(KDSME::StateMachineScene *)
105
106#endif // VIEW_H

© 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 Tue Jul 15 2025 15:21:47 for KDStateMachineEditor API Documentation by doxygen 1.9.8