KD Reports API Documentation
2.1
|
#include <KDReportsTextElement.h>
Public Member Functions | |
TextElement (const QString &string=QString()) | |
TextElement (const TextElement &other) | |
~TextElement () override | |
void | build (ReportBuilder &builder) const override |
Element * | clone () const override |
QFont | font () const |
QString | id () const |
TextElement & | operator<< (const QString &) |
TextElement & | operator= (const TextElement &other) |
void | setBold (bool bold) |
Set font attribute: bold. More... | |
void | setFont (const QFont &) |
void | setFontFamily (const QString &family) |
Set font attribute: family. More... | |
void | setId (const QString &id) |
void | setItalic (bool italic) |
Set font attribute: italic. More... | |
void | setPointSize (qreal size) |
Set font attribute: size in points. Can be integer or decimal. More... | |
void | setStrikeOut (bool strikeout) |
Set font attribute: strike out. More... | |
void | setText (const QString &text) |
void | setTextColor (const QColor &color) |
void | setUnderline (bool underline) |
Set font attribute: underline. More... | |
QString | text () const |
QColor | textColor () const |
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) | |
Element & | operator= (const Element &other) |
The KDReports::TextElement class represents text in the report. This is one way to insert rich text into the report (the other way is with HtmlElement).
Definition at line 36 of file KDReportsTextElement.h.
Creates a text element.
Definition at line 43 of file KDReportsTextElement.cpp.
|
override |
Destroys this text element.
Definition at line 65 of file KDReportsTextElement.cpp.
KDReports::TextElement::TextElement | ( | const TextElement & | other | ) |
Copies a text element. The text and settings are copied over.
Definition at line 50 of file KDReportsTextElement.cpp.
|
overridevirtual |
Implements KDReports::Element.
Definition at line 69 of file KDReportsTextElement.cpp.
References QFont::Bold, QTextCursor::charFormat(), KDReports::cleanupVariableProperties(), QTextFormat::clearBackground(), QTextFormat::clearForeground(), KDReports::ReportBuilder::currentDocumentData(), KDReports::ReportBuilder::cursor(), QTextCharFormat::FontPropertiesSpecifiedOnly, QTextCursor::insertText(), Qt::NoBrush, QFont::Normal, QTextCursor::position(), QTextFormat::setBackground(), QTextCursor::setCharFormat(), QTextCharFormat::setFont(), QTextCharFormat::setFontFamily(), QTextCharFormat::setFontItalic(), QTextCharFormat::setFontPointSize(), QTextCharFormat::setFontStrikeOut(), QTextCharFormat::setFontUnderline(), QTextCharFormat::setFontWeight(), QTextFormat::setForeground(), and KDReports::TextDocumentData::setTextValueMarker().
Referenced by KDReports::ReportBuilder::addVariable().
|
overridevirtual |
Implements KDReports::Element.
Definition at line 169 of file KDReportsTextElement.cpp.
QFont KDReports::TextElement::font | ( | ) | const |
QString KDReports::TextElement::id | ( | ) | const |
Definition at line 179 of file KDReportsTextElement.cpp.
KDReports::TextElement & KDReports::TextElement::operator<< | ( | const QString & | str | ) |
Adds more text to the text in this element.
Definition at line 108 of file KDReportsTextElement.cpp.
KDReports::TextElement & KDReports::TextElement::operator= | ( | const TextElement & | other | ) |
Copies the text and settings from another text element.
Definition at line 56 of file KDReportsTextElement.cpp.
References KDReports::Element::operator=().
void KDReports::TextElement::setBold | ( | bool | bold | ) |
Set font attribute: bold.
Definition at line 124 of file KDReportsTextElement.cpp.
void KDReports::TextElement::setFont | ( | const QFont & | font | ) |
Set multiple font attributes with a single call.
Note that (since KDReports 1.6), when Qt is 5.3 or more, the font attributes that are not explicitly specified in this font, will be resolved against the report's default font, rather than being resolved against the application's font.
Definition at line 153 of file KDReportsTextElement.cpp.
void KDReports::TextElement::setFontFamily | ( | const QString & | family | ) |
Set font attribute: family.
Definition at line 119 of file KDReportsTextElement.cpp.
void KDReports::TextElement::setId | ( | const QString & | id | ) |
Set the ID associated with this text element.
Definition at line 174 of file KDReportsTextElement.cpp.
void KDReports::TextElement::setItalic | ( | bool | italic | ) |
Set font attribute: italic.
Definition at line 130 of file KDReportsTextElement.cpp.
void KDReports::TextElement::setPointSize | ( | qreal | size | ) |
Set font attribute: size in points. Can be integer or decimal.
Definition at line 148 of file KDReportsTextElement.cpp.
void KDReports::TextElement::setStrikeOut | ( | bool | strikeout | ) |
Set font attribute: strike out.
Definition at line 142 of file KDReportsTextElement.cpp.
void KDReports::TextElement::setText | ( | const QString & | text | ) |
Sets the full text in this element.
Definition at line 114 of file KDReportsTextElement.cpp.
void KDReports::TextElement::setTextColor | ( | const QColor & | color | ) |
void KDReports::TextElement::setUnderline | ( | bool | underline | ) |
Set font attribute: underline.
Definition at line 136 of file KDReportsTextElement.cpp.
QString KDReports::TextElement::text | ( | ) | const |
Definition at line 184 of file KDReportsTextElement.cpp.
QColor KDReports::TextElement::textColor | ( | ) | const |