25 #include <QSortFilterProxyModel>
28 #include <tulip/Observable.h>
29 #include <tulip/TulipModel.h>
33 class PropertyInterface;
34 class BooleanProperty;
36 class TLP_QT_SCOPE GraphModel :
public tlp::TulipModel,
public Observable {
49 explicit GraphModel(QObject *parent = NULL);
55 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
56 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
57 QModelIndex parent(
const QModelIndex &child)
const;
58 Qt::ItemFlags flags(
const QModelIndex &index)
const;
60 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const;
61 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const;
62 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const;
63 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
66 void treatEvents(
const std::vector<tlp::Event> &);
68 unsigned int elementAt(
int)
const;
72 virtual bool isNode()
const = 0;
75 QVector<unsigned int> _elements;
76 QVector<QPair<unsigned int,bool> > _elementsToModify;
77 QVector<PropertyInterface*> _properties;
82 class TLP_QT_SCOPE GraphSortFilterProxyModel:
public QSortFilterProxyModel,
public Observable {
83 QVector<PropertyInterface*> _properties;
84 BooleanProperty* _filterProperty;
87 GraphSortFilterProxyModel(QObject* parent = NULL);
90 void setSelectedOnly(
bool);
91 void setProperties(QVector<PropertyInterface*>);
93 bool lessThan(
const QModelIndex &left,
const QModelIndex &right)
const;
94 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const;
101 class TLP_QT_SCOPE NodesGraphModel:
public GraphModel {
103 NodesGraphModel(QObject* parent = NULL);
104 void setGraph(Graph *);
110 bool isNode()
const {
118 class TLP_QT_SCOPE EdgesGraphModel:
public GraphModel {
120 EdgesGraphModel(QObject* parent = NULL);
121 void setGraph(Graph *);
127 bool isNode()
const {
136 #endif // GRAPHMODEL_H