GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Public Member Functions | Public Attributes | Protected Attributes | List of all members
GraphModel Class Reference

#include <graph_model.h>

Inheritance diagram for GraphModel:
Inheritance graph
[legend]
Collaboration diagram for GraphModel:
Collaboration graph
[legend]

Public Member Functions

 GraphModel (QObject *parent=0)
 
QVariant data (const QModelIndex &index, int role) const
 Overloads of functions required for QAbstractItemModel interface.
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 Provides the index for a specific position in the model.
 
QModelIndex parent (const QModelIndex &index) const
 Provides the parent for a given index.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Number of rows.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 Number of columns.
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 Provides header to use.
 

Public Attributes

std::map< std::string,
GraphModelItem * > 
items
 List of nodes that are in this tree, indexed by name in this case that might change later (?)
 

Protected Attributes

GraphModelItemroot_item_
 Root Item for the data model. This is a no-use item.
 

Detailed Description

This is an implementation of the QAbstractItemModel interface for usage with various types of Graphs provided by Grapher. We use it in order to expose Grapher to the GUI elements such as NodeWidgets/EdgeWidgets as well as other types of Widgets like the built-in QT Tree Widget. By exposing an QAbstractItemModel like this we can fully utilize all the functionality of the QT library without having to build our own custom widgets to handle our Graph Data Type.

It is subclassed by specific implementations to generate actual models from actual graphs.

To read more about the QT Model-View architecture these are useful links: Model/View Tutorial Model/View Programming Simple Tree Model Example QAbstractItemModel reference documentation

The way that this model exposes the graph is essentially through an adjacency list. Each node is a child item from the root and then in turn has one child item per other node which it has an edge too.

In some implementations it is also possible to build a tree. The tree would then have a number of levels based on the edges emanating from the root of the tree. Each level would represent one further degree away from root.


The documentation for this class was generated from the following files: