KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
HtmlBuilder Class Reference

Streaming HTML fragment builder. More...

#include <htmlbuilder.h>

Public Member Functions

 HtmlBuilder ()
 Construct an empty builder.
 
void startParagraph (const QColor &color=QColor(), const QColor &backgroundColor=QColor())
 Append an opening <p> tag with optional foreground and background colors.
 
void endParagraph ()
 Append a closing </p> tag.
 
void startBold ()
 Append an opening <b> tag.
 
void endBold ()
 Append a closing </b> tag.
 
void startStrong ()
 Append an opening <strong> tag.
 
void endStrong ()
 Append a closing </strong> tag.
 
void appendText (const QString &text)
 Append plain text to the output.
 
QString toString () const
 Return the accumulated HTML string.
 

Detailed Description

Streaming HTML fragment builder.

HtmlBuilder accumulates HTML into an internal string via a QTextStream. Call the open/close methods in order, then retrieve the result with toString().

Definition at line 24 of file htmlbuilder.h.

Member Function Documentation

◆ appendText()

void HtmlBuilder::appendText ( const QString &  text)

Append plain text to the output.

Parameters
textText to append (not HTML-escaped)

◆ startParagraph()

void HtmlBuilder::startParagraph ( const QColor &  color = QColor(),
const QColor &  backgroundColor = QColor() 
)

Append an opening <p> tag with optional foreground and background colors.

Parameters
colorForeground text color (invalid QColor = none)
backgroundColorBackground color (invalid QColor = none)

◆ toString()

QString HtmlBuilder::toString ( ) const
inline

Return the accumulated HTML string.

Returns
HTML fragment built so far

Definition at line 60 of file htmlbuilder.h.


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