# class toPieChart

A widget that displays a piechart. More...

Definition | `#include <topiechart.h>`
Inherits | QWidget (qt) [public ]
Inherited by | toResultPie
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- toPieChart (QWidget *parent=NULL,const char *name=NULL,WFlags f=0)
- toPieChart (toPieChart *pie,QWidget *parent=NULL,const char *name=NULL,WFlags f=0)
- void setPostfix (const QString &post)
- const QString & postfix (void) const
- void setTitle (const QString &title=QString::null)
- const QString & title (void)
- void setDisplayPercent (bool pct)
- bool displayPercent (void) const
- void showLegend (bool on)
- bool legend (void) const
- void setValues (std::list<double> &values,std::list<QString> &labels)
- void addValue (double value,const QString &label)
- std::list<double> & values (void)
- std::list<QString> & labels (void)

#### Public Slots

- void editPrint (void)
- void openCopy (void)

#### Protected Methods

- virtual void mouseDoubleClickEvent (QMouseEvent *e)
- virtual void mousePressEvent (QMouseEvent *e)
- virtual void paintChart (QPainter *p,QRect rect)
- virtual void paintEvent (QPaintEvent *e)

## Detailed Description

A widget that displays a piechart.

void mouseDoubleClickEvent (QMouseEvent *e)

### mouseDoubleClickEvent

[protected virtual]

Reimplemented from QWidget.

void mousePressEvent (QMouseEvent *e)

### mousePressEvent

[protected virtual]

Reimplemented from QWidget.

toPieChart (QWidget *parent=NULL,const char *name=NULL,WFlags f=0)

### toPieChart

Create a new piechart.

Parameters:

parent | Parent widget.
name | Name of widget.
f | Widget flags.

toPieChart (toPieChart *pie,QWidget *parent=NULL,const char *name=NULL,WFlags f=0)

### toPieChart

Create a copy of a piechart.

Parameters:

pie | Pie chart to copy.
parent | Parent widget.
name | Name of widget.
f | Widget flags.

void setPostfix (const QString &post)

### setPostfix

Set the postfix text to append the current values when they are displayed in the pie.

Parameters:

post | Postfix string, no space will be added after the value before the string so if you want the space you need to specify it first in this string.

const QString & postfix (void)

### postfix

[const]

Get the postfix string.

Returns: Current postfix string.

void setTitle (const QString &title=QString::null)

### setTitle

Set title of the chart. Set to empty string to not display title.

Parameters:

title | Title of chart.

const QString & title (void)

### title

Get title of chart.

Returns: Title of chart.

void setDisplayPercent (bool pct)

### setDisplayPercent

Display piecharts in percent instead of actual values

Parameters:

pct | Wether or not to display percent only.

bool displayPercent (void)

### displayPercent

[const]

Check if only percent is displayed

Returns: True if only percent is displayed.

void showLegend (bool on)

### showLegend

Specify if legend should be displayed to the right of the graph, default is on.

Parameters:

on | Whether to display graph or not.

bool legend (void)

### legend

[const]

Check if legend is displayed or not.

Returns: If legend is displayed or not.

void setValues (std::list<double> &values,std::list<QString> &labels)

### setValues

Set value list of piechart.

Parameters:

values | List of values to display.
labels | List of labels, if label is empty it will not appear in legend.

void addValue (double value,const QString &label)

### addValue

Add a value to the piechart.

Parameters:

value | New value to add.
label | Label of this new value.

std::list<double> & values (void)

### values

Get list of values.

Returns: Values in piechart.

std::list<QString> & labels (void)

### labels

Get labels of piechart.

Returns: List of labels.

void editPrint (void)

### editPrint

[slot]

Print the chart

void openCopy (void)

### openCopy

[slot]

Open in new window

void paintChart (QPainter *p,QRect rect)

### paintChart

[protected virtual]

Paint chart in a given rectangle.

void paintEvent (QPaintEvent *e)

### paintEvent

[protected virtual]

Reimplemented for internal reasons.

Reimplemented from QWidget.