25 #include <QtCore/QVector>
26 #include <QtGui/QSortFilterProxyModel>
27 #include <tulip/Observable.h>
28 #include <tulip/TulipModel.h>
32 class PropertyInterface;
34 class TLP_QT_SCOPE GraphModel :
public tlp::TulipModel,
public Observable {
46 explicit GraphModel(QObject *parent = NULL);
52 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
53 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
54 QModelIndex parent(
const QModelIndex &child)
const;
55 Qt::ItemFlags flags(
const QModelIndex &index)
const;
57 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const;
58 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const;
59 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const;
60 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
63 void treatEvents(
const std::vector<tlp::Event> &);
65 unsigned int elementAt(
int)
const;
69 virtual bool isNode()
const = 0;
72 QVector<unsigned int> _elements;
73 QVector<QPair<unsigned int,bool> > _elementsToModify;
74 QVector<tlp::PropertyInterface*> _properties;
79 class TLP_QT_SCOPE GraphSortFilterProxyModel:
public QSortFilterProxyModel,
public tlp::Observable {
80 QVector<PropertyInterface*> _properties;
84 GraphSortFilterProxyModel(QObject* parent = NULL);
87 void setSelectedOnly(
bool);
88 void setProperties(QVector<PropertyInterface*>);
90 bool lessThan(
const QModelIndex &left,
const QModelIndex &right)
const;
91 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const;
98 class TLP_QT_SCOPE NodesGraphModel:
public GraphModel {
100 NodesGraphModel(QObject* parent = NULL);
101 void setGraph(Graph *);
107 bool isNode()
const {
115 class TLP_QT_SCOPE EdgesGraphModel:
public GraphModel {
117 EdgesGraphModel(QObject* parent = NULL);
118 void setGraph(Graph *);
124 bool isNode()
const {
133 #endif // GRAPHMODEL_H