KD Reports API Documentation
2.0
|
#include <KDReportsChartElement.h>
Public Member Functions | |
ChartElement (const ChartElement &other) | |
ChartElement (const QString &modelKey) | |
ChartElement (KDChart::Chart *chart) | |
ChartElement (QAbstractItemModel *tableModel) | |
~ChartElement () override | |
void | build (ReportBuilder &) const override |
Element * | clone () const override |
ChartElement & | operator= (const ChartElement &other) |
void | setChart (KDChart::Chart *chart) |
void | setModelKey (const QString &modelKey) |
void | setSize (qreal width, qreal height, Unit unit=Millimeters) |
void | setTableModel (QAbstractItemModel *tableModel) |
QSizeF | size () const |
Unit | unit () const |
Public Member Functions inherited from KDReports::Element | |
virtual | ~Element () |
QBrush | background () const |
void | setBackground (const QBrush &brush) |
Additional Inherited Members | |
Protected Member Functions inherited from KDReports::Element | |
Element () | |
Element (const Element &other) | |
Element & | operator= (const Element &other) |
The KDReports::ChartElement class represents a chart in the report. The data is provided by a QAbstractItemModel.
Definition at line 41 of file KDReportsChartElement.h.
|
explicit |
Creates a chart element from the given table model.
Definition at line 68 of file KDReportsChartElement.cpp.
|
explicit |
Creates a chart element that does not have an associated model yet. The association will be done later using the model key.
Definition at line 74 of file KDReportsChartElement.cpp.
References KDReports::modelForKey().
|
explicit |
Creates a chart element from the given chart.
The chart's ownership is NOT transferred. It is very important that the chart exists at least as long as the report object exists.
Definition at line 81 of file KDReportsChartElement.cpp.
|
override |
Destroys this chart element.
Definition at line 108 of file KDReportsChartElement.cpp.
KDReports::ChartElement::ChartElement | ( | const ChartElement & | other | ) |
Copies a chart element.
Definition at line 93 of file KDReportsChartElement.cpp.
|
overridevirtual |
Implements KDReports::Element.
Definition at line 128 of file KDReportsChartElement.cpp.
References KDReports::ReportBuilder::cursor().
|
overridevirtual |
Implements KDReports::Element.
Definition at line 177 of file KDReportsChartElement.cpp.
KDReports::ChartElement & KDReports::ChartElement::operator= | ( | const ChartElement & | other | ) |
Copies the data from another chart element.
Definition at line 99 of file KDReportsChartElement.cpp.
References KDReports::Element::operator=().
void KDReports::ChartElement::setChart | ( | KDChart::Chart * | chart | ) |
Sets the chart to use in this chart element. Useful for associating a chart to a ChartElement from XmlElementHandler.
The chart's ownership is NOT transferred. It is very important that the chart exists at least as long as the report object exists.
Definition at line 110 of file KDReportsChartElement.cpp.
void KDReports::ChartElement::setModelKey | ( | const QString & | modelKey | ) |
set the model key associated with this element
Definition at line 192 of file KDReportsChartElement.cpp.
References KDReports::modelForKey().
void KDReports::ChartElement::setSize | ( | qreal | width, |
qreal | height, | ||
Unit | unit = Millimeters |
||
) |
Sets the size of the chart. The default size is a 100% of the page width, for both width and height.
To set a chart size that adapts well to any page size, use Percent as unit. setSize(50, 75, Percent) means that the width will be half of the page width (without margins), and the height will always be 1.5 times the width (preserving the ratio between 50 and 75). This feature (Percent) leads to slightly worse results on screen at 100% zoom, due to scaling happening even at that size, but the printed report should be fine.
Definition at line 122 of file KDReportsChartElement.cpp.
void KDReports::ChartElement::setTableModel | ( | QAbstractItemModel * | tableModel | ) |
set the model associated with this element
Definition at line 198 of file KDReportsChartElement.cpp.
QSizeF KDReports::ChartElement::size | ( | ) | const |
Definition at line 182 of file KDReportsChartElement.cpp.
KDReports::Unit KDReports::ChartElement::unit | ( | ) | const |