VTK
Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
vtkQtChartLegend Class Reference

The vtkQtChartLegend class displays a chart legend. More...

#include <vtkQtChartLegend.h>

Public Types

enum  LegendLocation { Left = 0, Top, Right, Bottom }
enum  ItemFlow { LeftToRight = 0, TopToBottom }

Public Slots

void reset ()
 Resets the chart legend.
void setOffset (int offset)
 Sets the panning offset.

Signals

void locationChanged ()
 Emitted when the legend location is changed.

Public Member Functions

 vtkQtChartLegend (QWidget *parent=0)
 Creates a chart legend instance.
virtual ~vtkQtChartLegend ()
int getOffset () const
 Gets the panning offset.
virtual QSize sizeHint () const
 Gets the preferred size of the chart legend.
void drawLegend (QPainter &painter)
 Draws the legend using the given painter.
Setup Methods
vtkQtChartLegendModelgetModel () const
 Gets the legend model.
LegendLocation getLocation () const
 Gets the legend location.
void setLocation (LegendLocation location)
 Sets the legend location.
ItemFlow getFlow () const
 Gets the legend item flow.
void setFlow (ItemFlow flow)
 Sets the legend item flow.

Protected Slots

void insertEntry (int index)
 Inserts a new entry in the legend.
void startEntryRemoval (int index)
 Starts the entry removal process.
void finishEntryRemoval (int index)
 Finishes the entry removal process.
void updateEntryText (int index)
 Updates the text for the given entry.
void updateEntryVisible (int index)
 Updates the visibility for the given entry.

Protected Member Functions

virtual bool event (QEvent *e)
 Updates the layout when the font changes.
virtual void paintEvent (QPaintEvent *e)
 Draws the chart title.
virtual void resizeEvent (QResizeEvent *e)
 Updates the maximum offset when the size changes.
virtual void mousePressEvent (QMouseEvent *e)
 Used for panning the contents of the legend.
virtual void mouseMoveEvent (QMouseEvent *e)
 Used for panning the contents of the legend.
virtual void mouseReleaseEvent (QMouseEvent *e)
 Used for panning the contents of the legend.

Detailed Description

The vtkQtChartLegend class displays a chart legend.

A vtkQtChartLegendModel is used to describe the entries. Each entry can have an icon and a label. The icon is used to visually identify the series on the chart. For a line chart series, the image should be drawn in the same color and line style.

Definition at line 47 of file vtkQtChartLegend.h.

Member Enumeration Documentation

Enumerator:
Left 

Place the legend on the left of the chart.

Top 

Place the legend on the top of the chart.

Right 

Place the legend on the right of the chart.

Bottom 

Place the legend on the bottom of the chart.

Definition at line 52 of file vtkQtChartLegend.h.

Enumerator:
LeftToRight 

Items are arranged left to right.

TopToBottom 

Items are arranged top to bottom.

Definition at line 60 of file vtkQtChartLegend.h.

Constructor & Destructor Documentation

vtkQtChartLegend::vtkQtChartLegend ( QWidget *  parent = 0)

Creates a chart legend instance.

Parameters
parentThe parent widget.
virtual vtkQtChartLegend::~vtkQtChartLegend ( )
virtual

Member Function Documentation

vtkQtChartLegendModel* vtkQtChartLegend::getModel ( ) const
inline

Gets the legend model.

Returns
A pointer to the legend model.

Definition at line 79 of file vtkQtChartLegend.h.

LegendLocation vtkQtChartLegend::getLocation ( ) const
inline

Gets the legend location.

Returns
The legend location.

Definition at line 85 of file vtkQtChartLegend.h.

void vtkQtChartLegend::setLocation ( LegendLocation  location)

Sets the legend location.

The chart uses the location to place the legend in the appropriate place. The combination of location and flow determine how the legend looks.

Parameters
locationThe new legend location.
ItemFlow vtkQtChartLegend::getFlow ( ) const
inline

Gets the legend item flow.

Returns
The legend item flow.

Definition at line 101 of file vtkQtChartLegend.h.

void vtkQtChartLegend::setFlow ( ItemFlow  flow)

Sets the legend item flow.

The flow is used to determine the layout direction of the legend entries. Depending on the location, the same flow type can look different.

Parameters
flowThe new item flow.
int vtkQtChartLegend::getOffset ( ) const

Gets the panning offset.

Returns
The current panning offset.
virtual QSize vtkQtChartLegend::sizeHint ( ) const
inlinevirtual

Gets the preferred size of the chart legend.

Returns
The preferred size of the chart legend.

Definition at line 124 of file vtkQtChartLegend.h.

void vtkQtChartLegend::drawLegend ( QPainter &  painter)

Draws the legend using the given painter.

Parameters
painterThe painter to use.
void vtkQtChartLegend::locationChanged ( )
signal

Emitted when the legend location is changed.

void vtkQtChartLegend::reset ( )
slot

Resets the chart legend.

void vtkQtChartLegend::setOffset ( int  offset)
slot

Sets the panning offset.

The offset is applied to the x or y axis depending on the legend's location.

Parameters
offsetThe new panning offset.
void vtkQtChartLegend::insertEntry ( int  index)
protectedslot

Inserts a new entry in the legend.

Parameters
indexWhere to insert the entry.
void vtkQtChartLegend::startEntryRemoval ( int  index)
protectedslot

Starts the entry removal process.

Parameters
indexThe entry being removed.
void vtkQtChartLegend::finishEntryRemoval ( int  index)
protectedslot

Finishes the entry removal process.

Parameters
indexThe entry that was removed.
void vtkQtChartLegend::updateEntryText ( int  index)
protectedslot

Updates the text for the given entry.

Parameters
indexThe index of the modified entry.
void vtkQtChartLegend::updateEntryVisible ( int  index)
protectedslot

Updates the visibility for the given entry.

Parameters
indexThe index of the modified entry.
virtual bool vtkQtChartLegend::event ( QEvent *  e)
protectedvirtual

Updates the layout when the font changes.

Parameters
eEvent specific information.
Returns
True if the event was handled.
virtual void vtkQtChartLegend::paintEvent ( QPaintEvent *  e)
protectedvirtual

Draws the chart title.

Parameters
eEvent specific information.
virtual void vtkQtChartLegend::resizeEvent ( QResizeEvent *  e)
protectedvirtual

Updates the maximum offset when the size changes.

Parameters
eEvent specific information.
virtual void vtkQtChartLegend::mousePressEvent ( QMouseEvent *  e)
protectedvirtual

Used for panning the contents of the legend.

The widget cursor is set for panning.

Parameters
eEvent specific information.
virtual void vtkQtChartLegend::mouseMoveEvent ( QMouseEvent *  e)
protectedvirtual

Used for panning the contents of the legend.

The conents are moved by changing the offset.

Parameters
eEvent specific information.
virtual void vtkQtChartLegend::mouseReleaseEvent ( QMouseEvent *  e)
protectedvirtual

Used for panning the contents of the legend.

The widget cursor is reset after panning.

Parameters
eEvent specific information.

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