KD Reports API Documentation  2.2
Public Member Functions | List of all members
KDReports::TableElement Class Reference

#include <KDReportsTableElement.h>

Inheritance diagram for KDReports::TableElement:
KDReports::AbstractTableElement KDReports::Element

Public Member Functions

 TableElement ()
 
 TableElement (const TableElement &other)
 
 ~TableElement () override
 
void build (ReportBuilder &) const override
 
Cellcell (int row, int column)
 
Elementclone () const override
 
int columnCount () const
 
int headerColumnCount () const
 
int headerRowCount () const
 
TableElementoperator= (const TableElement &other)
 
int rowCount () const
 
void setHeaderColumnCount (int count)
 
void setHeaderRowCount (int count)
 
- Public Member Functions inherited from KDReports::AbstractTableElement
qreal border () const
 
QBrush borderBrush () const
 
QFont defaultFont (bool *isSet) const
 
qreal padding () const
 
void setBorder (qreal border)
 
void setBorderBrush (const QBrush &brush)
 
void setColumnConstraints (const QVector< ColumnConstraint > &constraints)
 
void setDefaultFont (const QFont &font)
 
void setPadding (qreal padding)
 
void setWidth (qreal width, Unit unit=Millimeters)
 
Unit unit () const
 
qreal width () const
 
- Public Member Functions inherited from KDReports::Element
virtual ~Element ()
 
QBrush background () const
 
void setBackground (const QBrush &brush)
 

Additional Inherited Members

- Public Types inherited from KDReports::AbstractTableElement
enum  { Variable = Unit::Percent + 1 }
 
- Protected Member Functions inherited from KDReports::AbstractTableElement
 AbstractTableElement ()
 
 AbstractTableElement (const AbstractTableElement &other)
 
 ~AbstractTableElement () override
 
void fillTableFormat (QTextTableFormat &tableFormat, QTextCursor &textDocCursor) const
 
AbstractTableElementoperator= (const AbstractTableElement &other)
 
- Protected Member Functions inherited from KDReports::Element
 Element ()
 
 Element (const Element &other)
 
Elementoperator= (const Element &other)
 

Detailed Description

The KDReports::TableElement class represents a table in the report. Use cell() to provide the contents for each cell of the table.

Use AutoTableElement instead if you have the data in a QAbstractItemModel.

Definition at line 26 of file KDReportsTableElement.h.

Constructor & Destructor Documentation

◆ TableElement() [1/2]

KDReports::TableElement::TableElement ( )

Creates an empty table. Text and other content can be added to the table cells using the cell() method. This must be done before the table is added to the report.

Definition at line 41 of file KDReportsTableElement.cpp.

◆ ~TableElement()

KDReports::TableElement::~TableElement ( )
override

Destructor. Deletes internal data.

Definition at line 61 of file KDReportsTableElement.cpp.

◆ TableElement() [2/2]

KDReports::TableElement::TableElement ( const TableElement other)

Copies a table element. Settings and cell elements are copied over.

Definition at line 46 of file KDReportsTableElement.cpp.

Member Function Documentation

◆ build()

void KDReports::TableElement::build ( ReportBuilder builder) const
overridevirtual

◆ cell()

KDReports::Cell & KDReports::TableElement::cell ( int  row,
int  column 
)

Returns the reference to a cell in the table. This is the method to use in order to fill the table. Cells are created on demand, you don't have to define a number of rows and columns before hand.

Parameters
rownumber, starting from 0
columnnumber, starting from 0

Definition at line 101 of file KDReportsTableElement.cpp.

◆ clone()

KDReports::Element * KDReports::TableElement::clone ( ) const
overridevirtual

Implements KDReports::Element.

Definition at line 65 of file KDReportsTableElement.cpp.

◆ columnCount()

int KDReports::TableElement::columnCount ( ) const
Returns
number of columns, based on the calls to cell(row, column)
Since
2.3

Definition at line 96 of file KDReportsTableElement.cpp.

◆ headerColumnCount()

int KDReports::TableElement::headerColumnCount ( ) const
Returns
table header columns count.
Since
1.4

Definition at line 86 of file KDReportsTableElement.cpp.

◆ headerRowCount()

int KDReports::TableElement::headerRowCount ( ) const
Returns
table header rows count.
Since
1.4

Definition at line 76 of file KDReportsTableElement.cpp.

◆ operator=()

KDReports::TableElement & KDReports::TableElement::operator= ( const TableElement other)

Copies the settings and cell elements from another table element.

Definition at line 52 of file KDReportsTableElement.cpp.

References KDReports::AbstractTableElement::operator=().

◆ rowCount()

int KDReports::TableElement::rowCount ( ) const
Returns
number of rows, based on the calls to cell(row, column)
Since
2.3

Definition at line 91 of file KDReportsTableElement.cpp.

◆ setHeaderColumnCount()

void KDReports::TableElement::setHeaderColumnCount ( int  count)

Declares the first count columns of the table as table header. The table header columns get repeated when a table is broken into multiple pages horizontally (see Report::scaleTo). The default number of header rows is 0.

Since
1.1

Definition at line 81 of file KDReportsTableElement.cpp.

◆ setHeaderRowCount()

void KDReports::TableElement::setHeaderRowCount ( int  count)

Declares the first count rows of the table as table header. The table header rows get repeated when a table is broken across a page boundary. The default number of header rows is 0.

Definition at line 71 of file KDReportsTableElement.cpp.


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

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-reports/
Generated by doxygen 1.9.1