Reference documentation
Public Member Functions | List of all members
GraphView Class Reference

The Thistle::GraphView class provides an item view to display graphs. More...

Inheritance diagram for GraphView:
AbstractItemView

Public Member Functions

 GraphView (QWidget *parent=0)
 Constructs a graph view with the given parent.
 
 ~GraphView ()
 Destructs the current view.
 
AbstractGraphAlgorithmalgorithm () const
 Returns the current algorithm used to calculate the positions.
 
virtual QPainterPath itemPath (const QModelIndex &index) const
 Returns the QPainterPath defining the item's shape. More...
 
void paintEdges (QPainter &painter, const QPointF &offset=QPointF(0, 0)) const
 Paints the edges between the nodes on the painter device. More...
 
void paintItems (QPainter &painter, const QPointF &offset=QPointF(0, 0)) const
 Paints the nodes associated tothe items on the painter device. More...
 
void setAlgorithm (AbstractGraphAlgorithm *algorithm)
 Sets the algorithm system used to calculate the positions. More...
 
- Public Member Functions inherited from AbstractItemView
 AbstractItemView (QWidget *parent=0)
 Constructs an abstract item view with the given parent.
 
virtual QRectF itemRect (const QModelIndex &index) const
 Defines the outer bounds of the item as a rectangle. More...
 
virtual QRectF itemRect (int row, int column, const QModelIndex &parent=QModelIndex()) const
 This function overloads itemRect(). More...
 

Additional Inherited Members

- Public Slots inherited from AbstractItemView
virtual void updateValues ()=0
 Updates the items in the item view. More...
 

Detailed Description

The Thistle::GraphView class provides an item view to display graphs.

The Thistle::GraphView class is based on the Thistle::AbstractItemView class. This class is used with Thistle::GraphModel and Thistle::AbstractGraphAlgorithm classes.

The Thistle::GraphModel classes is a simple implementation of a model which contains the nodes and the edges. The Thistle::AbstractGraphAlgorithm is used to calculate the position of each node relative to the edge. The Thistle::GraphAlgorithm class provides a default implementation with a basic algorithm.

Member Function Documentation

QPainterPath itemPath ( const QModelIndex &  index) const
virtual

Returns the QPainterPath defining the item's shape.

The path must be defined in the outer bounds returned by the itemRect() function.

Implements AbstractItemView.

void paintEdges ( QPainter &  painter,
const QPointF &  offset = QPointF( 0, 0 ) 
) const

Paints the edges between the nodes on the painter device.

The offset can be used if the view has to be centered (i.e. if some node has a negative position).

void paintItems ( QPainter &  painter,
const QPointF &  offset = QPointF( 0, 0 ) 
) const

Paints the nodes associated tothe items on the painter device.

The offset can be used if the view has to be centered (i.e. if some node has a negative position).

void setAlgorithm ( AbstractGraphAlgorithm algorithm)

Sets the algorithm system used to calculate the positions.

This function will not destroy the previous algorithm.