KDStateMachineEditor API Documentation 2.1
Loading...
Searching...
No Matches
objecttreemodel.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_UTIL_OBJECTTREEMODEL_H
17#define KDSME_UTIL_OBJECTTREEMODEL_H
18
19#include "kdsme_core_export.h"
20
21#include <QAbstractItemModel>
22
23namespace KDSME {
24
25class ObjectTreeModelPrivate;
26
27class KDSME_CORE_EXPORT ObjectTreeModel : public QAbstractItemModel
28{
29 Q_OBJECT
30
31public:
32 class KDSME_CORE_EXPORT AppendOperation // krazy:exclude=dpointer // clazy:exclude=rule-of-three
33 {
34 public:
35 AppendOperation(ObjectTreeModel *model, QObject *parent, int count = 1, int index = -1);
37
38 private:
39 ObjectTreeModel *m_model;
40 };
41
42 class KDSME_CORE_EXPORT RemoveOperation // krazy:exclude=dpointer // clazy:exclude=rule-of-three
43 {
44 public:
45 RemoveOperation(ObjectTreeModel *model, QObject *object);
47
48 private:
49 ObjectTreeModel *m_model;
50 };
51
52 class KDSME_CORE_EXPORT ResetOperation // krazy:exclude=dpointer // clazy:exclude=rule-of-three
53 {
54 public:
55 explicit ResetOperation(ObjectTreeModel *model);
57
58 private:
59 ObjectTreeModel *m_model;
60 };
61
62 class KDSME_CORE_EXPORT ReparentOperation // krazy:exclude=dpointer // clazy:exclude=rule-of-three
63 {
64 public:
65 ReparentOperation(ObjectTreeModel *model, QObject *object, QObject *newParent);
67
68 private:
69 ObjectTreeModel *m_model;
70 };
71
72 enum Roles
73 {
74 ObjectRole = Qt::UserRole + 1,
76 UserRole = Qt::UserRole + 100
77 };
78
79 explicit ObjectTreeModel(QObject *parent = nullptr);
81
82 void appendRootObject(QObject *object);
83 QList<QObject *> rootObjects() const;
84 void setRootObject(QObject *rootObject);
85 void setRootObjects(const QList<QObject *> &rootObjects);
86 void clear();
87
88 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
89 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
90 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
91 QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override;
92 QModelIndex parent(const QModelIndex &index) const override;
93 QHash<int, QByteArray> roleNames() const override;
94
95 QModelIndex indexForObject(QObject *object) const;
96
97protected:
98 Q_DECLARE_PRIVATE(ObjectTreeModel)
99 ObjectTreeModelPrivate *const d_ptr;
100};
101
102}
103
104Q_DECLARE_METATYPE(KDSME::ObjectTreeModel *)
105
106#endif
@ ObjectIdRole
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