1 /*
2     SPDX-License-Identifier: GPL-2.0-or-later
3     SPDX-FileCopyrightText: 2015-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4 */
5 
6 #ifndef DIAGRAMSMODEL_H
7 #define DIAGRAMSMODEL_H
8 
9 // app includes
10 #include "umlviewlist.h"
11 
12 // qt includes
13 #include <QAbstractTableModel>
14 #include <QPointer>
15 
16 class UMLView;
17 
18 Q_DECLARE_METATYPE(UMLView*);
19 
20 class DiagramsModel : public QAbstractTableModel
21 {
22     Q_OBJECT
23 public:
24     explicit DiagramsModel();
25 
26     int rowCount(const QModelIndex &parent) const;
27     int columnCount(const QModelIndex &parent) const;
28 
29     QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
30     QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
31 
32     bool addDiagram(UMLView *view);
33     bool removeDiagram(UMLView *view);
34     bool removeAllDiagrams();
35 
36     void emitDataChanged(const QModelIndex &index);
37     void emitDataChanged(int index);
38     void emitDataChanged(UMLView *view);
39 
40 protected:
41     int m_count;
42     UMLViewList m_views;
43 };
44 
45 #endif // STEREOTYPESMODEL_H
46