#include <vtkQtChartLegend.h>
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.
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 | |
vtkQtChartLegendModel * | getModel () 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. |
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.
LeftToRight | Items are arranged left to right. |
TopToBottom | Items are arranged top to bottom. |
Definition at line 60 of file vtkQtChartLegend.h.
vtkQtChartLegend::vtkQtChartLegend | ( | QWidget * | parent = 0 |
) |
Creates a chart legend instance.
parent | The parent widget. |
virtual vtkQtChartLegend::~vtkQtChartLegend | ( | ) | [virtual] |
vtkQtChartLegendModel* vtkQtChartLegend::getModel | ( | ) | const [inline] |
Gets the legend model.
Definition at line 79 of file vtkQtChartLegend.h.
LegendLocation vtkQtChartLegend::getLocation | ( | ) | const [inline] |
Gets 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.
location | The new legend location. |
ItemFlow vtkQtChartLegend::getFlow | ( | ) | const [inline] |
Gets 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.
flow | The new item flow. |
int vtkQtChartLegend::getOffset | ( | ) | const |
Gets the panning offset.
virtual QSize vtkQtChartLegend::sizeHint | ( | ) | const [inline, virtual] |
Gets 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.
painter | The 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.
offset | The new panning offset. |
void vtkQtChartLegend::insertEntry | ( | int | index | ) | [protected, slot] |
Inserts a new entry in the legend.
index | Where to insert the entry. |
void vtkQtChartLegend::startEntryRemoval | ( | int | index | ) | [protected, slot] |
Starts the entry removal process.
index | The entry being removed. |
void vtkQtChartLegend::finishEntryRemoval | ( | int | index | ) | [protected, slot] |
Finishes the entry removal process.
index | The entry that was removed. |
void vtkQtChartLegend::updateEntryText | ( | int | index | ) | [protected, slot] |
Updates the text for the given entry.
index | The index of the modified entry. |
void vtkQtChartLegend::updateEntryVisible | ( | int | index | ) | [protected, slot] |
Updates the visibility for the given entry.
index | The index of the modified entry. |
virtual bool vtkQtChartLegend::event | ( | QEvent * | e | ) | [protected, virtual] |
Updates the layout when the font changes.
e | Event specific information. |
virtual void vtkQtChartLegend::paintEvent | ( | QPaintEvent * | e | ) | [protected, virtual] |
Draws the chart title.
e | Event specific information. |
virtual void vtkQtChartLegend::resizeEvent | ( | QResizeEvent * | e | ) | [protected, virtual] |
Updates the maximum offset when the size changes.
e | Event specific information. |
virtual void vtkQtChartLegend::mousePressEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
Used for panning the contents of the legend.
The widget cursor is set for panning.
e | Event specific information. |
virtual void vtkQtChartLegend::mouseMoveEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
Used for panning the contents of the legend.
The conents are moved by changing the offset.
e | Event specific information. |
virtual void vtkQtChartLegend::mouseReleaseEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
Used for panning the contents of the legend.
The widget cursor is reset after panning.
e | Event specific information. |