Reference documentation
Public Member Functions | Protected Member Functions | List of all members
AbstractTree Class Referenceabstract

The AbstractTree class is the base class for every tree view. More...

Inheritance diagram for AbstractTree:
AbstractItemView RadialTree VerticalTree HorizontalTree

Public Member Functions

 AbstractTree (QWidget *parent=0)
 Initializes an AbstractTree object. More...
 
QPen connectionPen () const
 Returns the QPen used to paint the connection between a parent and its children.
 
virtual QPainterPath itemPath (const QModelIndex &index) const
 Defines the outer bounds of the item as a QPainterPath. More...
 
virtual QRectF itemRect (const QModelIndex &index) const
 Defines the outer bounds of the item as a rectangle. More...
 
void setConnectionPen (const QPen &pen)
 Sets the QPen used to paint the connection between a parent and its children.
 
void setItemSpacing (int w, int h)
 Sets the spacing between two items.
 
- Public Member Functions inherited from AbstractItemView
 AbstractItemView (QWidget *parent=0)
 Constructs an abstract item view with the given parent.
 
virtual QRectF itemRect (int row, int column, const QModelIndex &parent=QModelIndex()) const
 This function overloads itemRect(). More...
 

Protected Member Functions

virtual void paintConnections (QPainter &painter, const QPointF &offset) const
 Paints the connections between the parents and its children.
 
virtual void paintConnectionsFor (QPainter &painter, const QModelIndex &index, const QPointF &offset) const
 Paints the connections between index and its children.
 
virtual void paintItems (QPainter &painter, const QPointF &offset) const
 Paints the items in the view using the results of the positionInView() method.
 
virtual void positionsInTree ()=0
 Defines the positions of the items in the tree.
 
virtual void positionsInView ()=0
 Defines the positions of the items in the view relative to their positions in the tree. More...
 
virtual void setX (const QModelIndex &index, qreal x)
 Sets the X coordinates for the given index to x.
 
virtual void setY (const QModelIndex &index, qreal y)
 Sets the Y coordinates for the given index to y.
 
virtual void updateValues ()
 Updates the items in the item view. More...
 

Additional Inherited Members

- Public Slots inherited from AbstractItemView

Detailed Description

The AbstractTree class is the base class for every tree view.

AbstractTree is an abstract class and cannot be instancied itself.

It provides standard support for managing tree structure stored in a QStandardItemModel.

A class that inherits Tree only needs to implement their own item positioning system.

The position of an tiem is defined with its position in the tree. Note that positions are not updated until the structure of the given model has changed.

See Also
Thistle::VerticalTree, Thistle::HorizontalTree, Thistle::RadialTree, Thistle::AbstractItemView

Constructor & Destructor Documentation

AbstractTree ( QWidget *  parent = 0)
explicit

Initializes an AbstractTree object.

The AbstractTree is abstract and cannot be instancied itself.

Member Function Documentation

virtual QPainterPath itemPath ( const QModelIndex &  index) const
virtual

Defines the outer bounds of the item as a QPainterPath.

All painting must be restricted to inside an item's bounding QPainterPath.

Implements AbstractItemView.

virtual QRectF itemRect ( const QModelIndex &  index) const
virtual

Defines the outer bounds of the item as a rectangle.

All painting must be restricted to inside an item's bounding rect. Although the item's shape can be arbitrary, the bounding rect is always rectangular.

Reimplemented from AbstractItemView.

void positionsInView ( )
protectedpure virtual

Defines the positions of the items in the view relative to their positions in the tree.

This function uses the margins and the item size to calculate

Implemented in VerticalTree, RadialTree, and HorizontalTree.

virtual void updateValues ( )
protectedvirtual

Updates the items in the item view.

This function must be called whenever the model has changed.

Implements AbstractItemView.