KD Reports API Documentation
2.1
|
#include <KDReportsAutoTableElement.h>
Public Types | |
enum | Role { DecorationAlignmentRole = 0x2D535FB1, NonBreakableLinesRole = 0x2D535FB2 } |
Additional Inherited Members | |
Protected Member Functions inherited from KDReports::AbstractTableElement | |
AbstractTableElement () | |
AbstractTableElement (const AbstractTableElement &other) | |
~AbstractTableElement () override | |
void | fillTableFormat (QTextTableFormat &tableFormat, QTextCursor &textDocCursor) const |
AbstractTableElement & | operator= (const AbstractTableElement &other) |
Protected Member Functions inherited from KDReports::Element | |
Element () | |
Element (const Element &other) | |
Element & | operator= (const Element &other) |
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.
Definition at line 40 of file KDReportsAutoTableElement.h.
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.
|
Definition at line 154 of file KDReportsAutoTableElement.h.
|
explicit |
Creates a table element from the given table model. Note that the argument isn't const because KDReports will call fetchMore() on it, if canFetchMore() returns true.
Definition at line 220 of file KDReportsAutoTableElement.cpp.
References tableModel().
|
explicit |
Creates a table element that does not have an associated model yet. The association will be done later using the model key.
Definition at line 226 of file KDReportsAutoTableElement.cpp.
References KDReports::modelForKey().
|
override |
Destructor. Deletes internal data.
Definition at line 247 of file KDReportsAutoTableElement.cpp.
KDReports::AutoTableElement::AutoTableElement | ( | const AutoTableElement & | other | ) |
Copies a table element. The model and settings are copied over.
Definition at line 232 of file KDReportsAutoTableElement.cpp.
|
overridevirtual |
Implements KDReports::Element.
Definition at line 267 of file KDReportsAutoTableElement.cpp.
References QTextBlockFormat::alignment(), QTextCursor::beginEditBlock(), QTextCursor::blockFormat(), QTextTable::cellAt(), KDReports::ReportBuilder::currentDocument(), KDReports::ReportBuilder::currentDocumentData(), KDReports::ReportBuilder::cursor(), QTextCursor::End, QTextCursor::endEditBlock(), KDReports::HeaderColumnsProperty, QSize::height(), Qt::Horizontal, QTextCursor::insertTable(), QSize::isValid(), QTextTableCell::isValid(), QTextCursor::movePosition(), KDReports::TextDocumentData::registerAutoTable(), QVector::resize(), QTextTableFormat::setAlignment(), QTextFormat::setBackground(), QTextTableCell::setFormat(), QTextTableFormat::setHeaderRowCount(), QTextFormat::setProperty(), Qt::Vertical, and QSize::width().
|
overridevirtual |
Implements KDReports::Element.
Definition at line 344 of file KDReportsAutoTableElement.cpp.
QBrush KDReports::AutoTableElement::headerBackground | ( | ) | const |
Definition at line 400 of file KDReportsAutoTableElement.cpp.
Referenced by KDReports::MainTable::setAutoTableElement().
QSize KDReports::AutoTableElement::iconSize | ( | ) | const |
Definition at line 380 of file KDReportsAutoTableElement.cpp.
Referenced by KDReports::MainTable::setAutoTableElement().
bool KDReports::AutoTableElement::isHorizontalHeaderVisible | ( | ) | const |
Definition at line 370 of file KDReportsAutoTableElement.cpp.
Referenced by KDReports::TableBreakingSettingsDialog::TableBreakingSettingsDialog(), and KDReports::MainTable::setAutoTableElement().
bool KDReports::AutoTableElement::isVerticalHeaderVisible | ( | ) | const |
Definition at line 365 of file KDReportsAutoTableElement.cpp.
Referenced by KDReports::TableBreakingSettingsDialog::TableBreakingSettingsDialog(), and KDReports::MainTable::setAutoTableElement().
KDReports::AutoTableElement & KDReports::AutoTableElement::operator= | ( | const AutoTableElement & | other | ) |
Copies the model and settings from another table element.
Definition at line 238 of file KDReportsAutoTableElement.cpp.
References KDReports::AbstractTableElement::operator=().
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.
Definition at line 360 of file KDReportsAutoTableElement.cpp.
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.
Definition at line 355 of file KDReportsAutoTableElement.cpp.
void KDReports::AutoTableElement::setIconSize | ( | 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.
Definition at line 375 of file KDReportsAutoTableElement.cpp.
void KDReports::AutoTableElement::setModelKey | ( | const QString & | modelKey | ) |
set the model key associated with this element
Definition at line 395 of file KDReportsAutoTableElement.cpp.
References KDReports::modelForKey().
void KDReports::AutoTableElement::setTableModel | ( | QAbstractItemModel * | tableModel | ) |
set the model associated with this element
Definition at line 390 of file KDReportsAutoTableElement.cpp.
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.
Definition at line 350 of file KDReportsAutoTableElement.cpp.
QAbstractItemModel * KDReports::AutoTableElement::tableModel | ( | ) | const |
Definition at line 385 of file KDReportsAutoTableElement.cpp.
Referenced by AutoTableElement(), and KDReports::MainTable::setAutoTableElement().