GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
graph_model.h
1 #ifndef GUI_GRAPH_MODEL_H_
2 #define GUI_GRAPH_MODEL_H_
3 
4 #include <QObject>
5 #include <QList>
6 #include <QAbstractItemModel>
7 #include <QDebug>
8 #include <queue>
9 
10 #include "grapher.h"
11 #include "graph_model_item.h"
12 
13 
36 class GraphModel : public QAbstractItemModel {
37  Q_OBJECT
38 
39  public:
40  GraphModel(QObject* parent = 0);
41  virtual ~GraphModel();
42 
44  QVariant data(const QModelIndex &index, int role) const;
45 
47  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
48 
50  QModelIndex parent(const QModelIndex &index) const;
51 
53  int rowCount(const QModelIndex &parent = QModelIndex()) const;
54 
56  int columnCount(const QModelIndex &parent = QModelIndex()) const;
57 
59  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
60 
61  // This can be reimplemented to provide flags to the model
62  //Qt::ItemFlags flags(const QModelIndex &index, const QModelIndex &parent = QModelIndex());
63 
65  std::map<std::string, GraphModelItem*> items;
66 
67  protected:
70 };
71 
72 #endif
Definition: graph_model.h:36
QVariant data(const QModelIndex &index, int role) const
Overloads of functions required for QAbstractItemModel interface.
Definition: graph_model.cc:14
QModelIndex parent(const QModelIndex &index) const
Provides the parent for a given index.
Definition: graph_model.cc:44
int rowCount(const QModelIndex &parent=QModelIndex()) const
Number of rows.
Definition: graph_model.cc:58
Definition: graph_model_item.h:22
int columnCount(const QModelIndex &parent=QModelIndex()) const
Number of columns.
Definition: graph_model.cc:72
GraphModelItem * root_item_
Root Item for the data model. This is a no-use item.
Definition: graph_model.h:69
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Provides header to use.
Definition: graph_model.cc:81
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Provides the index for a specific position in the model.
Definition: graph_model.cc:26
std::map< std::string, GraphModelItem * > items
List of nodes that are in this tree, indexed by name in this case that might change later (...
Definition: graph_model.h:65