summaryrefslogtreecommitdiffstats
path: root/src/qt3support/text
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-05-28 08:27:50 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-05-28 08:31:07 (GMT)
commitf390f9b51cf8686e9ed44f13a33c7349b9e96a09 (patch)
tree162c768769713a7215bca64daf8f2bdc75c9fbee /src/qt3support/text
parent0bb0699d403b7541472a72a4057ecf0ca366a7cd (diff)
downloadQt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.zip
Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.gz
Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.bz2
improved string operations all over the place
used character operations whenever possible better usage of QLatin1String
Diffstat (limited to 'src/qt3support/text')
-rw-r--r--src/qt3support/text/q3richtext.cpp28
-rw-r--r--src/qt3support/text/q3textedit.cpp4
2 files changed, 16 insertions, 16 deletions
diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp
index e508001..d02f961 100644
--- a/src/qt3support/text/q3richtext.cpp
+++ b/src/qt3support/text/q3richtext.cpp
@@ -1678,7 +1678,7 @@ void Q3TextDocument::setRichTextInternal(const QString &text, Q3TextCursor* curs
if (curtag.style->displayMode() == Q3StyleSheetItem::DisplayListItem) {
// we are in a li and a new block comes along
- if (nstyle->name() == QString(QLatin1String("ul")) || nstyle->name() == QLatin1String("ol"))
+ if (nstyle->name() == QLatin1String("ul") || nstyle->name() == QLatin1String("ol"))
hasNewPar = false; // we want an empty li (like most browsers)
if (!hasNewPar) {
/* do not add new blocks inside
@@ -1857,7 +1857,7 @@ void Q3TextDocument::setRichTextInternal(const QString &text, Q3TextCursor* curs
curtag.format = curtag.format.makeTextFormat(nstyle, attr, scaleFontsFactor);
if (nstyle->isAnchor()) {
if (!anchorName.isEmpty())
- anchorName += QLatin1String("#") + attr[QLatin1String("name")];
+ anchorName += QLatin1Char('#') + attr[QLatin1String("name")];
else
anchorName = attr[QLatin1String("name")];
curtag.anchorHref = attr[QLatin1String("href")];
@@ -2436,7 +2436,7 @@ QString Q3TextDocument::richText() const
list_type = QLatin1String(" type=") + list_style_to_string(p->listStyle());
for (int i = pastListDepth; i < listDepth; i++) {
s += list_is_ordered(p->listStyle()) ? QLatin1String("<ol") : QLatin1String("<ul");
- s += list_type + QLatin1String(">");
+ s += list_type + QLatin1Char('>');
}
} else {
s += QLatin1Char('\n');
@@ -2463,7 +2463,7 @@ QString Q3TextDocument::richText() const
s += margin_to_string(item_li, p->utm, p->ubm, p->ulm, p->urm, p->uflm);
s += list_value_to_string(p->listValue());
s += direction_to_string(p->direction());
- s += QLatin1String(">");
+ s += QLatin1Char('>');
s += ps;
s += QLatin1String("</li>");
} else if (p->listDepth()) {
@@ -2471,7 +2471,7 @@ QString Q3TextDocument::richText() const
s += align_to_string(p->alignment());
s += margin_to_string(item_div, p->utm, p->ubm, p->ulm, p->urm, p->uflm);
s += direction_to_string(p->direction());
- s += QLatin1String(">");
+ s += QLatin1Char('>');
s += ps;
s += QLatin1String("</div>");
} else {
@@ -2480,7 +2480,7 @@ QString Q3TextDocument::richText() const
s += align_to_string(p->alignment());
s += margin_to_string(item_p, p->utm, p->ubm, p->ulm, p->urm, p->uflm);
s += direction_to_string(p->direction());
- s += QLatin1String(">");
+ s += QLatin1Char('>');
s += ps;
s += QLatin1String("</p>");
}
@@ -6667,7 +6667,7 @@ Q3TextImage::Q3TextImage(Q3TextDocument *p, const QMap<QString, QString> &attr,
imageName = attr[QLatin1String("source")];
if (!imageName.isEmpty()) {
- imgId = QString(QLatin1String("%1,%2,%3,%4")).arg(imageName).arg(width).arg(height).arg((ulong)&factory);
+ imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((ulong)&factory);
if (!pixmap_map)
pixmap_map = new QMap<QString, QPixmapInt>;
if (pixmap_map->contains(imgId)) {
@@ -6761,13 +6761,13 @@ QString Q3TextImage::richText() const
s += QLatin1String("<img ");
QMap<QString, QString>::ConstIterator it = attributes.begin();
for (; it != attributes.end(); ++it) {
- s += it.key() + QLatin1String("=");
+ s += it.key() + QLatin1Char('=');
if ((*it).contains(QLatin1Char(' ')))
- s += QLatin1String("\"") + *it + QLatin1String("\" ");
+ s += QLatin1Char('\"') + *it + QLatin1String("\" ");
else
- s += *it + QLatin1String(" ");
+ s += *it + QLatin1Char(' ');
}
- s += QLatin1String(">");
+ s += QLatin1Char('>');
return s;
}
@@ -7722,7 +7722,7 @@ QString Q3TextTable::richText() const
s = QLatin1String("<table ");
QMap<QString, QString>::ConstIterator it = attributes.begin();
for (; it != attributes.end(); ++it)
- s += it.key() + QLatin1String("=") + *it + QLatin1String(" ");
+ s += it.key() + QLatin1Char('=') + *it + QLatin1Char(' ');
s += QLatin1String(">\n");
int lastRow = -1;
@@ -7739,8 +7739,8 @@ QString Q3TextTable::richText() const
s += QLatin1String("<td");
it = cell->attributes.constBegin();
for (; it != cell->attributes.constEnd(); ++it)
- s += QLatin1String(" ") + it.key() + QLatin1String("=") + *it;
- s += QLatin1String(">");
+ s += QLatin1Char(' ') + it.key() + QLatin1Char('=') + *it;
+ s += QLatin1Char('>');
s += cell->richText()->richText();
s += QLatin1String("</td>");
}
diff --git a/src/qt3support/text/q3textedit.cpp b/src/qt3support/text/q3textedit.cpp
index 7577dce..d1db1e4 100644
--- a/src/qt3support/text/q3textedit.cpp
+++ b/src/qt3support/text/q3textedit.cpp
@@ -77,7 +77,7 @@
#include <qkeysequence.h>
#define ACCEL_KEY(k) QLatin1Char('\t') + QString(QKeySequence(Qt::CTRL | Qt::Key_ ## k))
#else
-#define ACCEL_KEY(k) QLatin1Char('\t' )+ QString(QLatin1String("Ctrl+" #k))
+#define ACCEL_KEY(k) QLatin1Char('\t' )+ QString::fromLatin1("Ctrl+" #k)
#endif
#ifdef QT_TEXTEDIT_OPTIMIZATION
@@ -6625,7 +6625,7 @@ void Q3TextEdit::optimSetTextFormat(Q3TextDocument * td, Q3TextCursor * cur,
}
if (tag) {
QString col = tag->tag.simplified();
- if (col.left(10) == QLatin1String("font color")) {
+ if (col.startsWith(QLatin1String("font color"))) {
int i = col.indexOf(QLatin1Char('='), 10);
col = col.mid(i + 1).simplified();
if (col[0] == QLatin1Char('\"'))