KD Reports API Documentation  2.2
Public Types | Public Member Functions | List of all members
KDReports::Cell Class Referencefinal

#include <KDReportsCell.h>

Inheritance diagram for KDReports::Cell:
KDReports::Element

Public Types

using CellFormatFunc = std::function< void(int, int, QTextTableCellFormat &)>
 

Public Member Functions

 Cell (const Cell &other)
 
 ~Cell () override
 
void addElement (const Element &element, Qt::AlignmentFlag horizontalAlignment=Qt::AlignLeft)
 
void addInlineElement (const Element &element)
 
void addVariable (VariableType variable)
 
void addVerticalSpacing (qreal space)
 
void build (ReportBuilder &builder) const override
 
CellFormatFunc cellFormatFunction () const
 Returns the function passed to setCellFormatFunction() More...
 
Elementclone () const override
 
int columnSpan () const
 
Celloperator= (const Cell &other)
 
int rowSpan () const
 
void setCellFormatFunction (const CellFormatFunc &func)
 Sets the function to call in order to customize the format of the cell. More...
 
void setColumnSpan (int columnSpan)
 
void setRowSpan (int rowSpan)
 
void setVerticalAlignment (Qt::AlignmentFlag verticalAlignment)
 Set the vertical alignment of the cell contents. More...
 
Qt::AlignmentFlag verticalAlignment () const
 Returns the vertical alignment of the cell contents. More...
 
- 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)
 
Elementoperator= (const Element &other)
 

Detailed Description

This class presents a cell in a table. To add an element to a cell, first get hold of the right cell using Table::cell(), then add elements to it.

Definition at line 36 of file KDReportsCell.h.

Member Typedef Documentation

◆ CellFormatFunc

using KDReports::Cell::CellFormatFunc = std::function<void(int , int , QTextTableCellFormat &)>

Definition at line 95 of file KDReportsCell.h.

Constructor & Destructor Documentation

◆ ~Cell()

KDReports::Cell::~Cell ( )
override

Definition at line 46 of file KDReportsCell.cpp.

◆ Cell()

KDReports::Cell::Cell ( const Cell other)

Definition at line 31 of file KDReportsCell.cpp.

References Cell().

Referenced by Cell().

Member Function Documentation

◆ addElement()

void KDReports::Cell::addElement ( const Element element,
Qt::AlignmentFlag  horizontalAlignment = Qt::AlignLeft 
)

Adds an element to the cell, creating a new paragraph for it. You can specify the alignment of that paragraph.

Definition at line 75 of file KDReportsCell.cpp.

References KDReports::Element::clone().

◆ addInlineElement()

void KDReports::Cell::addInlineElement ( const Element element)

Adds an element to the cell, next to the previous element, in the same paragraph.

Definition at line 70 of file KDReportsCell.cpp.

References KDReports::Element::clone().

◆ addVariable()

void KDReports::Cell::addVariable ( VariableType  variable)

Adds an variable in the text of the current paragraph.

See also
KDReportsHeader::addVariable

Definition at line 80 of file KDReportsCell.cpp.

◆ addVerticalSpacing()

void KDReports::Cell::addVerticalSpacing ( qreal  space)

Adds vertical spacing between paragraphs. Make sure to call addElement after that, not addInlineElement.

Parameters
spacethe space in millimeters
Since
2.2

Definition at line 85 of file KDReportsCell.cpp.

References KDReports::ElementData::VerticalSpacing.

◆ build()

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

◆ cellFormatFunction()

KDReports::Cell::CellFormatFunc KDReports::Cell::cellFormatFunction ( ) const

Returns the function passed to setCellFormatFunction()

Since
2.3

Definition at line 105 of file KDReportsCell.cpp.

◆ clone()

Element* KDReports::Cell::clone ( ) const
inlineoverridevirtual

Implements KDReports::Element.

Definition at line 120 of file KDReportsCell.h.

◆ columnSpan()

int KDReports::Cell::columnSpan ( ) const

Returns the number of columns that this cell will span.

Definition at line 55 of file KDReportsCell.cpp.

◆ operator=()

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

Definition at line 37 of file KDReportsCell.cpp.

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

◆ rowSpan()

int KDReports::Cell::rowSpan ( ) const

Returns the number of rows that this cell will span.

Definition at line 65 of file KDReportsCell.cpp.

◆ setCellFormatFunction()

void KDReports::Cell::setCellFormatFunction ( const CellFormatFunc func)

Sets the function to call in order to customize the format of the cell.

This allows to set the width, style, and color of the 4 borders independently, customize the padding, etc.

Since
2.3

Definition at line 100 of file KDReportsCell.cpp.

◆ setColumnSpan()

void KDReports::Cell::setColumnSpan ( int  columnSpan)

Set the number of columns that this cell will span. The default is 1.

Definition at line 50 of file KDReportsCell.cpp.

◆ setRowSpan()

void KDReports::Cell::setRowSpan ( int  rowSpan)

Set the number of rows that this cell will span. The default is 1.

Definition at line 60 of file KDReportsCell.cpp.

◆ setVerticalAlignment()

void KDReports::Cell::setVerticalAlignment ( Qt::AlignmentFlag  verticalAlignment)

Set the vertical alignment of the cell contents.

Since
2.3

Definition at line 90 of file KDReportsCell.cpp.

◆ verticalAlignment()

Qt::AlignmentFlag KDReports::Cell::verticalAlignment ( ) const

Returns the vertical alignment of the cell contents.

Since
2.3

Definition at line 95 of file KDReportsCell.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