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 {
47 return TulipModel::flags(index) | Qt::ItemIsEditable;
57 class TLP_QT_SCOPE GraphNodeElementModel :
public GraphElementModel {
60 GraphNodeElementModel(Graph *graph,
unsigned int id, QObject *parent=NULL):GraphElementModel(graph,id,parent) {}
62 QString headerText(
unsigned int id)
const {
63 return QString(
"node : ") + QString::number(
id);
66 QVariant value(
unsigned int id, PropertyInterface *prop)
const {
67 return GraphModel::nodeValue(
id,prop);
70 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
74 class TLP_QT_SCOPE GraphEdgeElementModel :
public GraphElementModel {
77 GraphEdgeElementModel(Graph *graph,
unsigned int id, QObject *parent=NULL):GraphElementModel(graph,id,parent) {}
79 QString headerText(
unsigned int id)
const {
80 return QString(
"edge : ") + QString::number(
id);
83 QVariant value(
unsigned int id, PropertyInterface *prop)
const {
84 return GraphModel::edgeValue(
id,prop);
87 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
93 #endif // GRAPHELEMENTMODEL_H