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;
49 static void setApplicationDefaults(
tlp::Graph*);
51 explicit GraphHierarchiesModel(QObject *parent=0);
52 GraphHierarchiesModel(
const GraphHierarchiesModel &);
53 virtual ~GraphHierarchiesModel();
56 typedef QList<tlp::Graph *>::iterator iterator;
57 typedef QList<tlp::Graph *>::const_iterator const_iterator;
65 return _graphs.size();
69 return _graphs.begin();
74 const_iterator begin()
const {
75 return _graphs.begin();
77 const_iterator end()
const {
81 QList<tlp::Graph *> graphs()
const {
85 return _graphs.isEmpty();
89 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const;
90 QModelIndex parent(
const QModelIndex &child)
const;
91 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
92 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
93 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const;
94 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
95 Qt::ItemFlags flags(
const QModelIndex &index)
const;
96 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const;
97 QMimeData* mimeData(
const QModelIndexList &indexes)
const;
99 QModelIndex indexOf(
const Graph *);
100 QModelIndex forceGraphIndex(Graph *);
123 #endif // GRAPHHIERARCHIESMODEL_H