Grantlee: Grantlee::BBCodeBuilder Class Reference

Grantlee 5.1.0

Public Member Functions | List of all members
Grantlee::BBCodeBuilder Class Reference

Builder to create BBCode from a QTextDocument. More...

`#include <bbcodebuilder.h>`

Inheritance diagram for Grantlee::BBCodeBuilder:
[legend]

## Public Member Functions
| BBCodeBuilder ()
void | addNewline () override
void | appendLiteralText (const QString &text) override
void | beginAnchor (const QString &href=QString(), const QString &name=QString()) override
void | beginEmph () override
void | beginFontPointSize (int size) override
void | beginForeground (const QBrush &brush) override
void | beginList (QTextListFormat::Style type) override
void | beginListItem () override
void | beginParagraph (Qt::Alignment a=Qt::AlignLeft, qreal top=0.0, qreal bottom=0.0, qreal left=0.0, qreal right=0.0) override
void | beginStrikeout () override
void | beginStrong () override
void | beginSubscript () override
void | beginSuperscript () override
void | beginTable (qreal, qreal, const QString &) override
void | beginTableRow () override
void | beginUnderline () override
void | endAnchor () override
void | endEmph () override
void | endFontPointSize () override
void | endForeground () override
void | endList () override
void | endParagraph () override
void | endStrikeout () override
void | endStrong () override
void | endSubscript () override
void | endSuperscript () override
void | endUnderline () override
const QString | escape (const QString &text) const
QString | getResult () override
void | insertImage (const QString &src, qreal width, qreal height) override
Public Member Functions inherited from Grantlee::AbstractMarkupBuilder
virtual | ~AbstractMarkupBuilder ()
virtual void | appendRawText (const QString &text)=0
virtual void | beginBackground (const QBrush &brush)=0
virtual void | beginFontFamily (const QString &family)=0
virtual void | beginHeader (int level)=0
virtual void | beginTableCell (const QString &width, int colSpan, int rowSpan)=0
virtual void | beginTableHeaderCell (const QString &width, int colSpan, int rowSpan)=0
virtual void | endBackground ()=0
virtual void | endFontFamily ()=0
virtual void | endHeader (int level)=0
virtual void | endListItem ()=0
virtual void | endTable ()=0
virtual void | endTableCell ()=0
virtual void | endTableHeaderCell ()=0
virtual void | endTableRow ()=0
virtual void | insertHorizontalRule (int width=-1)=0

## Detailed Description

Definition at line 32 of file bbcodebuilder.h.

## Constructor & Destructor Documentation

## ◆ BBCodeBuilder()

Grantlee::BBCodeBuilder::BBCodeBuilder | ( |  | ) |

Creates a new BBCodeBuilder.

## Member Function Documentation

## ◆ addNewline()

void Grantlee::BBCodeBuilder::addNewline | ( |  | ) |
| overridevirtual

Add a newline to the markup.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ appendLiteralText()

void Grantlee::BBCodeBuilder::appendLiteralText | ( | const QString & | text | ) |
| overridevirtual

Append the plain text `text` to the markup.

Parameters

  text | The text to append.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginAnchor()

void Grantlee::BBCodeBuilder::beginAnchor | ( | const QString & | href = `QString()`,
|  | const QString & | name = `QString()`
| ) |  |
| overridevirtual

Begin a url anchor element in the markup

Parameters

  href | The href of the anchor.
  name | The name of the anchor.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginEmph()

void Grantlee::BBCodeBuilder::beginEmph | ( |  | ) |
| overridevirtual

Begin an emphasised element in the markup

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginFontPointSize()

void Grantlee::BBCodeBuilder::beginFontPointSize | ( | int | size | ) |
| overridevirtual

Begin an element of font size `size`. Note that this size is in pixels, and must be converted before it is suitable for use in BBCode.

Parameters

  size | The size of font to begin.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginForeground()

void Grantlee::BBCodeBuilder::beginForeground | ( | const QBrush & | brush | ) |
| overridevirtual

Begin a decorarated foreground element in the markup (A text color) using `brush`

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginList()

void Grantlee::BBCodeBuilder::beginList | ( | QTextListFormat::Style | style | ) |
| overridevirtual

Begin a new list element in the markup. A list element contains list items, and may contain other lists.

Parameters

  style | The style of list to create.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginListItem()

void Grantlee::BBCodeBuilder::beginListItem | ( |  | ) |
| overridevirtual

Begin a new list item in the markup

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginParagraph()

void Grantlee::BBCodeBuilder::beginParagraph | ( | Qt::Alignment | a = `Qt::AlignLeft`,
|  | qreal | top = `0.0`,
|  | qreal | bottom = `0.0`,
|  | qreal | left = `0.0`,
|  | qreal | right = `0.0`
| ) |  |
| overridevirtual

Begin a new paragraph in the markup

Parameters

  a | The alignment of the new paragraph.
  top | The top margin of the new paragraph.
  bottom | The bottom margin of the new paragraph.
  left | The left margin of the new paragraph.
  right | The right margin of the new paragraph.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginStrikeout()

void Grantlee::BBCodeBuilder::beginStrikeout | ( |  | ) |
| overridevirtual

Begin a struck out element in the markup

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginStrong()

void Grantlee::BBCodeBuilder::beginStrong | ( |  | ) |
| overridevirtual

Begin a bold element in the markup

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginSubscript()

void Grantlee::BBCodeBuilder::beginSubscript | ( |  | ) |
| overridevirtual

Begin a subscript element

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginSuperscript()

void Grantlee::BBCodeBuilder::beginSuperscript | ( |  | ) |
| overridevirtual

Begin a superscript element

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginTable()

void Grantlee::BBCodeBuilder::beginTable | ( | qreal | cellpadding,
|  | qreal | cellspacing,
|  | const QString & | width
| ) |  |
| overridevirtual

Begin a table element.

Parameters

  cellpadding | The padding attribute for the table.
  cellspacing | The spacing attribute for the table.
  width | The width of the table. May be either an integer, or a percentage value.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginTableRow()

void Grantlee::BBCodeBuilder::beginTableRow | ( |  | ) |
| overridevirtual

Begins a new table row.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ beginUnderline()

void Grantlee::BBCodeBuilder::beginUnderline | ( |  | ) |
| overridevirtual

Begin an underlined element in the markup

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endAnchor()

void Grantlee::BBCodeBuilder::endAnchor | ( |  | ) |
| overridevirtual

Close the anchor element

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endEmph()

void Grantlee::BBCodeBuilder::endEmph | ( |  | ) |
| overridevirtual

Close the emphasised element in the markup

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endFontPointSize()

void Grantlee::BBCodeBuilder::endFontPointSize | ( |  | ) |
| overridevirtual

End font point size element

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endForeground()

void Grantlee::BBCodeBuilder::endForeground | ( |  | ) |
| overridevirtual

Close the decorarated foreground element in the markup

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endList()

void Grantlee::BBCodeBuilder::endList | ( |  | ) |
| overridevirtual

Close the list.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endParagraph()

void Grantlee::BBCodeBuilder::endParagraph | ( |  | ) |
| overridevirtual

Close the paragraph in the markup.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endStrikeout()

void Grantlee::BBCodeBuilder::endStrikeout | ( |  | ) |
| overridevirtual

Close the struck out element in the markup

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endStrong()

void Grantlee::BBCodeBuilder::endStrong | ( |  | ) |
| overridevirtual

Close the bold element in the markup

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endSubscript()

void Grantlee::BBCodeBuilder::endSubscript | ( |  | ) |
| overridevirtual

End subscript element

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endSuperscript()

void Grantlee::BBCodeBuilder::endSuperscript | ( |  | ) |
| overridevirtual

End superscript element

Implements Grantlee::AbstractMarkupBuilder.

## ◆ endUnderline()

void Grantlee::BBCodeBuilder::endUnderline | ( |  | ) |
| overridevirtual

Close the underlined element in the markup

Implements Grantlee::AbstractMarkupBuilder.

## ◆ escape()

const QString Grantlee::BBCodeBuilder::escape | ( | const QString & | text | ) | const

Escapes `text` appropriately for BBCode.

## ◆ getResult()

QString Grantlee::BBCodeBuilder::getResult | ( |  | ) |
| overridevirtual

Return the fully marked up result of the building process. This may contain metadata etc, such as a head element in html.

Returns
  The fully marked up text.

Implements Grantlee::AbstractMarkupBuilder.

## ◆ insertImage()

void Grantlee::BBCodeBuilder::insertImage | ( | const QString & | url,
|  | qreal | width,
|  | qreal | height
| ) |  |
| overridevirtual

Insert a new image element into the markup.

Parameters

  url | The url of the image
  width | The width of the image
  height | The height of the image.

Implements Grantlee::AbstractMarkupBuilder.