kpimtextedit/richtextbuilders
24 #include "bbcodebuilder.h"
30 currentAlignment = Qt::AlignLeft;
39 m_text.append(
"[/B]");
47 m_text.append(
"[/I]");
55 m_text.append(
"[/U]");
63 m_text.append(
"[/S]");
67 m_text.append(QString(
"[COLOR=%1]").arg(brush.color().name()));
71 m_text.append(
"[/COLOR]");
78 m_text.append(QString(
"[URL=%1]").arg(href));
82 m_text.append(
"[/URL]");
89 m_text.append(QString(
"[SIZE=%1]").arg(QString::number(size)));
93 m_text.append(
"[/SIZE]");
102 if (a & Qt::AlignRight) {
103 m_text.append(
"\n[Right]");
104 }
else if (a & Qt::AlignHCenter) {
105 m_text.append(
"\n[CENTER]");
108 currentAlignment = a;
112 if (currentAlignment & Qt::AlignRight) {
113 m_text.append(
"\n[/Right]\n");
114 }
else if (currentAlignment & Qt::AlignHCenter) {
115 m_text.append(
"\n[/CENTER]\n");
119 currentAlignment = Qt::AlignLeft;
131 m_text.append(QString(
"[IMG]%1[/IMG]").arg(src));
137 case QTextListFormat::ListDisc:
138 case QTextListFormat::ListCircle:
139 case QTextListFormat::ListSquare:
140 m_text.append(
"[LIST]\n");
142 case QTextListFormat::ListDecimal:
143 m_text.append(
"[LIST=1]\n");
145 case QTextListFormat::ListLowerAlpha:
146 m_text.append(
"[LIST=a]\n");
148 case QTextListFormat::ListUpperAlpha:
149 m_text.append(
"[LIST=A]\n");
158 m_text.append(
"[/LIST]\n");
164 m_text.append(
"[*] ");
169 m_text.append(
"[SUP]");
174 m_text.append(
"[/SUP]");
179 m_text.append(
"[SUB]");
184 m_text.append(
"[/SUB]");
190 m_text.append(
"[TABLE]\n");
195 m_text.append(
"[/TABLE]");
201 m_text.append(escape(text));
204 const QString BBCodeBuilder::escape(
const QString &s)
206 if (s.contains(
"[")) {
207 return QString(
"[NOPARSE]" + s +
"[/NOPARSE]");
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jan 5 2013 19:44:42 by
doxygen 1.8.1.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.