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

#include <KDReportsHeader.h>

Public Member Functions

void addElement (const Element &element, Qt::AlignmentFlag horizontalAlignment=Qt::AlignLeft)
 
void addInlineElement (const Element &element)
 
void addVariable (VariableType variable)
 
void addVerticalSpacing (qreal space)
 
int currentPosition () const
 
QFont defaultFont () const
 
void setDefaultFont (const QFont &font)
 
void setTabPositions (const QList< QTextOption::Tab > &tabs)
 

Detailed Description

This class presents a header or footer in a report. To add an element to a header or footer, first get hold of the right header/footer using Report::header() or Report::footer(), then add elements to it.

Definition at line 44 of file KDReportsHeader.h.

Member Function Documentation

◆ addElement()

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

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

Definition at line 41 of file KDReportsHeader.cpp.

◆ addInlineElement()

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

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

Definition at line 35 of file KDReportsHeader.cpp.

◆ addVariable()

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

Adds a variable in the text of the current paragraph. Use addInlineElement before and/or after to complete the text of the paragraph. Example: "Page 1 / 3":

header.addInlineElement( KDReports::TextElement( "Page " ) );
header.addVariable( KDReports::PageNumber );
header.addInlineElement( KDReports::TextElement( " / " ) );
header.addVariable( KDReports::PageCount );

Definition at line 108 of file KDReportsHeader.cpp.

◆ addVerticalSpacing()

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

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

Parameters
spacethe space in millimeters

Definition at line 113 of file KDReportsHeader.cpp.

◆ currentPosition()

int KDReports::Header::currentPosition ( ) const

Definition at line 161 of file KDReportsHeader.cpp.

◆ defaultFont()

QFont KDReports::Header::defaultFont ( ) const
Returns
the default font used for text in this header
Since
1.4

Definition at line 151 of file KDReportsHeader.cpp.

◆ setDefaultFont()

void KDReports::Header::setDefaultFont ( const QFont font)

Sets the default font used for text in this header

Since
1.1

Definition at line 143 of file KDReportsHeader.cpp.

References QFont::ForceOutline, and QFont::setStyleStrategy().

Referenced by parseHeaderFooterAttribute().

◆ setTabPositions()

void KDReports::Header::setTabPositions ( const QList< QTextOption::Tab > &  tabs)

Set the list of tabs (tabulations) to use when adding block elements. Those tabs will be set for any block element that is added from now on, in this header. For more details see Report::setTabPositions.

Since
1.2

Definition at line 156 of file KDReportsHeader.cpp.


The documentation for this class was generated from the following files:
KDReports::PageNumber
@ PageNumber
Page number.
Definition: KDReportsVariableType.h:25
KDReports::TextElement
Definition: KDReportsTextElement.h:30
KDReports::PageCount
@ PageCount
Page count.
Definition: KDReportsVariableType.h:26

© 2007-2023 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 on Mon Sep 18 2023 00:21:34 for KD Reports API Documentation by doxygen 1.8.17