26 #include <QSortFilterProxyModel> 29 #include <tulip/Observable.h> 30 #include <tulip/TulipModel.h> 34 class PropertyInterface;
35 class BooleanProperty;
37 class TLP_QT_SCOPE GraphModel :
public tlp::TulipModel,
public Observable {
51 explicit GraphModel(QObject *parent = NULL);
57 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
58 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
59 QModelIndex parent(
const QModelIndex &child)
const;
60 Qt::ItemFlags flags(
const QModelIndex &index)
const;
62 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const;
63 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const;
64 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const;
65 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
68 void treatEvents(
const std::vector<tlp::Event> &);
70 unsigned int elementAt(
int)
const;
74 virtual bool isNode()
const = 0;
78 QVector<unsigned int> _elements;
79 QVector<QPair<unsigned int,bool> > _elementsToModify;
80 QVector<PropertyInterface*> _properties;
81 QSet<PropertyInterface*> _propertiesModified;
84 void addRemoveRowsSequence(
const QVector<unsigned int> &rowsSequence,
bool add);
87 class TLP_QT_SCOPE GraphSortFilterProxyModel:
public QSortFilterProxyModel,
public Observable {
88 QVector<PropertyInterface*> _properties;
89 BooleanProperty* _filterProperty;
92 GraphSortFilterProxyModel(QObject* parent = NULL);
95 void setSelectedOnly(
bool);
96 void setProperties(QVector<PropertyInterface*>);
98 bool lessThan(
const QModelIndex &left,
const QModelIndex &right)
const;
99 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const;
106 class TLP_QT_SCOPE NodesGraphModel:
public GraphModel {
108 NodesGraphModel(QObject* parent = NULL);
109 void setGraph(Graph *);
112 void treatEvents(
const std::vector<tlp::Event> &);
116 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const;
118 bool isNode()
const {
122 static QString getNodeTooltip(Graph *graph, node n);
131 class TLP_QT_SCOPE EdgesGraphModel:
public GraphModel {
133 EdgesGraphModel(QObject* parent = NULL);
134 void setGraph(Graph *);
136 void treatEvents(
const std::vector<tlp::Event> &);
140 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const;
142 bool isNode()
const {
146 static QString getEdgeTooltip(Graph *graph, edge e);
157 #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.