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;
80 void addRemoveRowsSequence(
const QVector<unsigned int> &rowsSequence,
bool add);
83 class TLP_QT_SCOPE GraphSortFilterProxyModel:
public QSortFilterProxyModel,
public Observable {
84 QVector<PropertyInterface*> _properties;
85 BooleanProperty* _filterProperty;
88 GraphSortFilterProxyModel(QObject* parent = NULL);
91 void setSelectedOnly(
bool);
92 void setProperties(QVector<PropertyInterface*>);
94 bool lessThan(
const QModelIndex &left,
const QModelIndex &right)
const;
95 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const;
102 class TLP_QT_SCOPE NodesGraphModel:
public GraphModel {
104 NodesGraphModel(QObject* parent = NULL);
105 void setGraph(Graph *);
108 void treatEvents(
const std::vector<tlp::Event> &);
112 bool isNode()
const {
123 class TLP_QT_SCOPE EdgesGraphModel:
public GraphModel {
125 EdgesGraphModel(QObject* parent = NULL);
126 void setGraph(Graph *);
128 void treatEvents(
const std::vector<tlp::Event> &);
133 bool isNode()
const {
145 #endif // GRAPHMODEL_H
A graph property that maps a boolean value to graph elements.
PropertyInterface describes the interface of a graph property.
Event is the base class for all events used in the Observation mechanism.