KD Reports  1.9
Public Types | Public Member Functions | List of all members
KDReports::AutoTableElement Class Reference

#include <KDReportsAutoTableElement.h>

Inheritance diagram for KDReports::AutoTableElement:
Inheritance graph
[legend]
Collaboration diagram for KDReports::AutoTableElement:
Collaboration graph
[legend]

Public Types

enum  { DecorationAlignmentRole = 0x2D535FB1, NonBreakableLinesRole = 0x2D535FB2 }
 

Public Member Functions

 AutoTableElement (QAbstractItemModel *tableModel)
 
 AutoTableElement (const QString &modelKey)
 
 ~AutoTableElement () override
 
 AutoTableElement (const AutoTableElement &other)
 
AutoTableElementoperator= (const AutoTableElement &other)
 
QAbstractItemModel * tableModel () const
 
void setTableModel (QAbstractItemModel *tableModel)
 
void setModelKey (const QString &modelKey)
 
void setVerticalHeaderVisible (bool visible)
 
void setHorizontalHeaderVisible (bool visible)
 
bool isVerticalHeaderVisible () const
 
bool isHorizontalHeaderVisible () const
 
void setHeaderBackground (const QBrush &brush)
 
QBrush headerBackground () const
 
void setIconSize (const QSize &iconSize)
 
QSize iconSize () const
 
- Public Member Functions inherited from KDReports::AbstractTableElement
void setBorder (qreal border)
 
qreal border () const
 
void setBorderBrush (const QBrush &brush)
 
QBrush borderBrush () const
 
void setPadding (qreal padding)
 
qreal padding () const
 
void setWidth (qreal width, Unit unit=Millimeters)
 
qreal width () const
 
Unit unit () const
 
void setDefaultFont (const QFont &font)
 
QFont defaultFont (bool *isSet) const
 
 AbstractTableElement (const AbstractTableElement &other)
 
AbstractTableElementoperator= (const AbstractTableElement &other)
 
void setColumnConstraints (const QVector< ColumnConstraint > &constraints)
 
- Public Member Functions inherited from KDReports::Element
virtual ~Element ()
 
void setBackground (const QBrush &brush)
 
QBrush background () const
 

Additional Inherited Members

- Protected Member Functions inherited from KDReports::AbstractTableElement
 AbstractTableElement ()
 
 ~AbstractTableElement () override
 
- Protected Member Functions inherited from KDReports::Element
 Element ()
 
 Element (const Element &other)
 
Elementoperator= (const Element &other)
 

Detailed Description

The KDReports::AutoTableElement class represents a table in the report, whose data is provided by a QAbstractItemModel. A header row is added if the QAbstractItemModel has horizontal header data, and a header column is added if the QAbstractItemModel has vertical header data. The header row is repeated on every page if the table is broken across page boundaries.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
DecorationAlignmentRole 

This model role allows to specify whether the icon should go before the text (Qt::AlignLeft) or after the text (Qt::AlignRight).

NonBreakableLinesRole 

This model role allows to specify that line-breaking is not allowed in this table cell.

Since
1.7.

Constructor & Destructor Documentation

◆ AutoTableElement() [1/3]

KDReports::AutoTableElement::AutoTableElement ( QAbstractItemModel *  tableModel)
explicit

Creates a table element from the given table model.

◆ AutoTableElement() [2/3]

KDReports::AutoTableElement::AutoTableElement ( const QString &  modelKey)
explicit

Creates a table element that does not have an associated model yet. The association will be done later using the model key.

◆ ~AutoTableElement()

KDReports::AutoTableElement::~AutoTableElement ( )
override

Destructor. Deletes internal data.

◆ AutoTableElement() [3/3]

KDReports::AutoTableElement::AutoTableElement ( const AutoTableElement other)

Copies a table element. The model and settings are copied over.

Member Function Documentation

◆ headerBackground()

QBrush KDReports::AutoTableElement::headerBackground ( ) const
Returns
the background color of the headers
Since
1.4

◆ iconSize()

QSize KDReports::AutoTableElement::iconSize ( ) const
Returns
the size passed to setIconSize
Since
1.3

◆ isHorizontalHeaderVisible()

bool KDReports::AutoTableElement::isHorizontalHeaderVisible ( ) const
Returns
true if the horizontal header will be visible
Since
1.1

◆ isVerticalHeaderVisible()

bool KDReports::AutoTableElement::isVerticalHeaderVisible ( ) const
Returns
true if the vertical header will be visible
Since
1.1

◆ operator=()

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

Copies the model and settings from another table element.

◆ setHeaderBackground()

void KDReports::AutoTableElement::setHeaderBackground ( const QBrush &  brush)

Sets the background color of the headers The default color is gray. Call setHeaderBackground(QBrush()) to disable the background color and have transparent headers instead.

◆ setHorizontalHeaderVisible()

void KDReports::AutoTableElement::setHorizontalHeaderVisible ( bool  visible)

Sets whether to show a horizontal header, showing header data from the model. This is true by default, call setHorizontalHeaderVisible(false) to hide the horizontal header.

◆ setIconSize()

void KDReports::AutoTableElement::setIconSize ( const QSize &  iconSize)

Sets the size of the decoration icons, in pixels. This is used when setting the DecorationRole to a QIcon in the model. Note that the model can also set it to a QPixmap or QImage, in which case the size in the report will simply be the size of the pixmap or image.

Since
1.1

◆ setModelKey()

void KDReports::AutoTableElement::setModelKey ( const QString &  modelKey)

set the model key associated with this element

Since
1.4

◆ setTableModel()

void KDReports::AutoTableElement::setTableModel ( QAbstractItemModel *  tableModel)

set the model associated with this element

Since
1.4

◆ setVerticalHeaderVisible()

void KDReports::AutoTableElement::setVerticalHeaderVisible ( bool  visible)

Sets whether to show a vertical header (showing header data from the model, or row numbers by default). This is true by default, call setVerticalHeaderVisible(false) to hide the vertical header.

◆ tableModel()

QAbstractItemModel* KDReports::AutoTableElement::tableModel ( ) const
Returns
the model associated with this element
Since
1.2

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

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/