21 #include "bbcodebuilder.h"
27 BBCodeBuilder::~BBCodeBuilder() {}
39 m_text.append(QStringLiteral(
"[COLOR=%1]").arg(brush.color().name()));
43 m_text.append(QStringLiteral(
"[/COLOR]"));
51 m_text.append(QStringLiteral(
"[URL=%1]").arg(href));
59 m_text.append(QStringLiteral(
"[SIZE=%1]").arg(QString::number(size)));
63 m_text.append(QStringLiteral(
"[/SIZE]"));
67 qreal left, qreal right)
73 if (a & Qt::AlignRight) {
74 m_text.append(QStringLiteral(
"\n[Right]"));
75 }
else if (a & Qt::AlignHCenter) {
76 m_text.append(QStringLiteral(
"\n[CENTER]"));
79 m_currentAlignment = a;
84 if (m_currentAlignment & Qt::AlignRight) {
85 m_text.append(QStringLiteral(
"\n[/Right]\n"));
86 }
else if (m_currentAlignment & Qt::AlignHCenter) {
87 m_text.append(QStringLiteral(
"\n[/CENTER]\n"));
89 m_text.append(QLatin1Char(
'\n'));
91 m_currentAlignment = Qt::AlignLeft;
100 m_text.append(QStringLiteral(
"[IMG]%1[/IMG]").arg(src));
106 case QTextListFormat::ListDisc:
107 case QTextListFormat::ListCircle:
108 case QTextListFormat::ListSquare:
109 m_text.append(QStringLiteral(
112 case QTextListFormat::ListDecimal:
113 m_text.append(QStringLiteral(
"[LIST=1]\n"));
115 case QTextListFormat::ListLowerAlpha:
116 m_text.append(QStringLiteral(
"[LIST=a]\n"));
118 case QTextListFormat::ListUpperAlpha:
119 m_text.append(QStringLiteral(
"[LIST=A]\n"));
132 m_text.append(QStringLiteral(
"[SUP]"));
137 m_text.append(QStringLiteral(
"[/SUP]"));
146 m_text.append(QStringLiteral(
"[TABLE]\n"));
151 m_text.append(QStringLiteral(
"[/TABLE]"));
156 m_text.append(
escape(text));
161 if (s.contains(QLatin1Char(
'['))) {
162 return QStringLiteral(
"[NOPARSE]") + s + QStringLiteral(
"[/NOPARSE]");
void endSubscript() override
void endFontPointSize() override
void endParagraph() override
void beginSubscript() override
void beginForeground(const QBrush &brush) override
void beginList(QTextListFormat::Style type) override
const QString escape(const QString &text) const
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 beginFontPointSize(int size) override
void beginTableRow() override
void beginSuperscript() override
void beginStrikeout() override
void endUnderline() override
void insertImage(const QString &src, qreal width, qreal height) override
void addNewline() override
void endStrong() override
void beginStrong() override
QString getResult() override
void endForeground() override
void endStrikeout() override
void beginTable(qreal, qreal, const QString &) override
void beginAnchor(const QString &href={}, const QString &name={}) override
void endSuperscript() override
void endAnchor() override
void appendLiteralText(const QString &text) override
void beginListItem() override
void beginUnderline() override
void beginEmph() override
The Cutelee namespace holds all public Cutelee API.