21 #ifndef GRAPHELEMENTMODEL_H
22 #define GRAPHELEMENTMODEL_H
24 #include <tulip/TulipModel.h>
25 #include <tulip/GraphModel.h>
29 class TLP_QT_SCOPE GraphElementModel:
public TulipModel {
33 GraphElementModel(Graph *graph,
unsigned int id, QObject *parent=NULL);
35 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
36 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
37 QModelIndex parent(
const QModelIndex &child)
const;
39 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const;
40 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const;
41 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const;
43 virtual QString headerText(
unsigned int id)
const = 0;
44 virtual QVariant value(
unsigned int id,PropertyInterface *prop)
const = 0;
46 Qt::ItemFlags flags(
const QModelIndex &index)
const;
55 class TLP_QT_SCOPE GraphNodeElementModel :
public GraphElementModel {
58 GraphNodeElementModel(Graph *graph,
unsigned int id, QObject *parent=NULL):GraphElementModel(graph,id,parent) {}
60 QString headerText(
unsigned int id)
const {
61 return QString(
"node : ") + QString::number(
id);
64 QVariant value(
unsigned int id, PropertyInterface *prop)
const {
65 return GraphModel::nodeValue(
id,prop);
68 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
72 class TLP_QT_SCOPE GraphEdgeElementModel :
public GraphElementModel {
75 GraphEdgeElementModel(Graph *graph,
unsigned int id, QObject *parent=NULL):GraphElementModel(graph,id,parent) {}
77 QString headerText(
unsigned int id)
const {
78 return QString(
"edge : ") + QString::number(
id);
81 QVariant value(
unsigned int id, PropertyInterface *prop)
const {
82 return GraphModel::edgeValue(
id,prop);
85 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
91 #endif // GRAPHELEMENTMODEL_H