1 /*
2     SPDX-License-Identifier: GPL-2.0-or-later
3     SPDX-FileCopyrightText: 2016-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4 */
5 
6 #ifndef OBJECTSMODEL_H
7 #define OBJECTSMODEL_H
8 
9 // qt includes
10 #include <QAbstractTableModel>
11 #include <QPointer>
12 
13 class UMLObject;
14 
15 class ObjectsModel : public QAbstractTableModel
16 {
17     Q_OBJECT
18 public:
19     explicit ObjectsModel();
20 
21     bool add(UMLObject *o);
22     bool remove(UMLObject *o);
23 
24     int rowCount(const QModelIndex &parent) const;
25     int columnCount(const QModelIndex &parent) const;
26 
27     QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
28     QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
29 
30     void emitDataChanged(const QModelIndex &index);
31     void emitDataChanged(int index);
32     void emitDataChanged(UMLObject *o);
33 
34 protected:
35     QList<QPointer<UMLObject>> m_allObjects;
36 };
37 
38 #endif // OBJECTSMODEL_H
39