21 #ifndef GRAPHHIERARCHIESMODEL_H
22 #define GRAPHHIERARCHIESMODEL_H
24 #include <tulip/tulipconf.h>
25 #include <tulip/TulipModel.h>
26 #include <tulip/Observable.h>
27 #include <tulip/Graph.h>
34 class GraphNeedsSavingObserver;
38 class TLP_QT_SCOPE GraphHierarchiesModel :
public tlp::TulipModel,
43 QList<tlp::Graph *> _graphs;
47 QMap<const tlp::Graph *, QModelIndex> _indexCache;
48 QMap<const tlp::Graph *, GraphNeedsSavingObserver *> _saveNeeded;
54 explicit GraphHierarchiesModel(QObject *parent =
nullptr);
55 GraphHierarchiesModel(
const GraphHierarchiesModel &);
56 ~GraphHierarchiesModel()
override;
59 typedef QList<tlp::Graph *>::iterator iterator;
60 typedef QList<tlp::Graph *>::const_iterator const_iterator;
68 return _graphs.size();
72 return _graphs.begin();
77 const_iterator begin()
const {
78 return _graphs.begin();
80 const_iterator end()
const {
84 QList<tlp::Graph *> graphs()
const {
88 return _graphs.isEmpty();
92 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const override;
93 QModelIndex parent(
const QModelIndex &child)
const override;
94 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
95 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
96 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
97 bool setData(
const QModelIndex &index,
const QVariant &value,
int role)
override;
98 Qt::ItemFlags flags(
const QModelIndex &index)
const override;
99 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const override;
100 QMimeData *mimeData(
const QModelIndexList &indexes)
const override;
102 QModelIndex indexOf(
const Graph *);
103 QModelIndex forceGraphIndex(Graph *);
107 void treatEvents(
const std::vector<tlp::Event> &)
override;
126 QSet<const Graph *> _graphsChanged;
Event is the base class for all events used in the Observation mechanism.
The Observable class is the base of Tulip's observation system.
PluginProcess subclasses are meant to notify about the progress state of some process (typically a pl...