21 #ifndef GRAPHHIERARCHIESMODEL_H
22 #define GRAPHHIERARCHIESMODEL_H
24 #include <tulip/tulipconf.h>
25 #include <tulip/TulipModel.h>
26 #include <tulip/Observable.h>
32 class GraphNeedsSavingObserver;
36 class TLP_QT_SCOPE GraphHierarchiesModel :
public tlp::TulipModel,
public tlp::Observable {
39 QList<tlp::Graph *> _graphs;
43 QMap<const tlp::Graph*,QModelIndex> _indexCache;
44 QMap<const tlp::Graph*, GraphNeedsSavingObserver*> _saveNeeded;
50 explicit GraphHierarchiesModel(QObject *parent=0);
51 GraphHierarchiesModel(
const GraphHierarchiesModel &);
52 virtual ~GraphHierarchiesModel();
55 typedef QList<tlp::Graph *>::iterator iterator;
56 typedef QList<tlp::Graph *>::const_iterator const_iterator;
64 return _graphs.size();
68 return _graphs.begin();
73 const_iterator begin()
const {
74 return _graphs.begin();
76 const_iterator end()
const {
80 QList<tlp::Graph *> graphs()
const {
84 return _graphs.isEmpty();
88 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const;
89 QModelIndex parent(
const QModelIndex &child)
const;
90 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
91 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
92 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const;
93 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
94 Qt::ItemFlags flags(
const QModelIndex &index)
const;
95 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const;
96 QMimeData* mimeData(
const QModelIndexList &indexes)
const;
98 QModelIndex indexOf(
const Graph *);
99 QModelIndex forceGraphIndex(Graph *);
122 #endif // GRAPHHIERARCHIESMODEL_H