KDStateMachineEditor API Documentation 2.1
Loading...
Searching...
No Matches
elementmodel.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_ELEMENTMODEL_H
17#define KDSME_MODEL_ELEMENTMODEL_H
18
19#include "element.h"
20#include "objecttreemodel.h"
21#include "kdsme_core_export.h"
22
23#include <QAbstractItemModel>
24#include <QObject>
25#include <QPointer>
26#include <QSortFilterProxyModel>
27
28namespace KDSME {
29
30class StateModel;
31class State;
32
33class KDSME_CORE_EXPORT TransitionModel : public QSortFilterProxyModel
34{
35 Q_OBJECT
36
37public:
38 explicit TransitionModel(QObject *parent = nullptr);
40
41 void setSourceModel(QAbstractItemModel *sourceModel) override;
42
43 bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
44
45private:
46 struct Private;
47 QScopedPointer<Private> d;
48};
49
50class KDSME_CORE_EXPORT TransitionListModel : public QAbstractListModel
51{
52 Q_OBJECT
53 Q_PROPERTY(KDSME::State *state READ state WRITE setState NOTIFY stateChanged)
54
55public:
56 enum Role
57 {
58 ObjectRole = Qt::UserRole + 1,
59 };
60
68
69 explicit TransitionListModel(QObject *parent = nullptr);
71
72 State *state() const;
73 void setState(State *state);
74
75 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
76 int columnCount(const QModelIndex &parent) const override;
77 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
78 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
79 QHash<int, QByteArray> roleNames() const override;
80
81Q_SIGNALS:
83
84private:
85 struct Private;
86 QScopedPointer<Private> d;
87};
88
89class KDSME_CORE_EXPORT StateModel : public ObjectTreeModel
90{
91 Q_OBJECT
92 Q_PROPERTY(KDSME::State *state READ state WRITE setState NOTIFY stateChanged)
93
94public:
95 enum Role
96 {
97 ElementRole = ObjectTreeModel::UserRole + 1,
99 };
100
101 explicit StateModel(QObject *parent = nullptr);
102 ~StateModel();
103
104 State *state() const;
105 void setState(State *state);
106
107 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
108 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
109 Qt::ItemFlags flags(const QModelIndex &index) const override;
110
111Q_SIGNALS:
113
114private:
115 struct Private;
116 QScopedPointer<Private> d;
117};
118
119}
120
121Q_DECLARE_METATYPE(KDSME::TransitionModel *)
122Q_DECLARE_METATYPE(KDSME::StateModel *)
123
124#endif
@ InternalIdRole
return quint64

© 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