Tests: Fix single-character string literals.

Use character literals where applicable.

Change-Id: I1a026c320079ee5ca6f70be835d5a541deee2dd1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-10-13 09:46:56 +02:00
parent e86f889de7
commit a2a00eb044
82 changed files with 264 additions and 260 deletions

View File

@ -265,7 +265,7 @@ void tst_QTextCodec::fromUnicode()
array is correct (no off by one, no trailing '\0'). array is correct (no off by one, no trailing '\0').
*/ */
QByteArray result = codec->fromUnicode(QString("abc")); QByteArray result = codec->fromUnicode(QString("abc"));
if (result.startsWith("a")) { if (result.startsWith('a')) {
QCOMPARE(result.size(), 3); QCOMPARE(result.size(), 3);
QCOMPARE(result, QByteArray("abc")); QCOMPARE(result, QByteArray("abc"));
} else { } else {
@ -573,7 +573,7 @@ void tst_QTextCodec::utf8Codec_data()
str = "Prohl"; str = "Prohl";
str += QChar::ReplacementCharacter; str += QChar::ReplacementCharacter;
str += QChar::ReplacementCharacter; str += QChar::ReplacementCharacter;
str += "e"; str += QLatin1Char('e');
str += QChar::ReplacementCharacter; str += QChar::ReplacementCharacter;
str += " plugin"; str += " plugin";
str += QChar::ReplacementCharacter; str += QChar::ReplacementCharacter;

View File

@ -821,7 +821,7 @@ void tst_qmessagehandler::qMessagePattern()
// test QT_MESSAGE_PATTERN // test QT_MESSAGE_PATTERN
// //
QStringList environment = m_baseEnvironment; QStringList environment = m_baseEnvironment;
environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + "\""); environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + QLatin1Char('"'));
process.setEnvironment(environment); process.setEnvironment(environment);
process.start(appExe); process.start(appExe);

View File

@ -301,7 +301,7 @@ void tst_QDataStream::cleanupTestCase()
static int dataIndex(const QString &tag) static int dataIndex(const QString &tag)
{ {
int pos = tag.lastIndexOf("_"); int pos = tag.lastIndexOf(QLatin1Char('_'));
if (pos >= 0) { if (pos >= 0) {
int ret = 0; int ret = 0;
QString count = tag.mid(pos + 1); QString count = tag.mid(pos + 1);
@ -338,7 +338,7 @@ void tst_QDataStream::stream_data(int noOfElements)
for (int b=0; b<2; b++) { for (int b=0; b<2; b++) {
QString byte_order = b == 0 ? "BigEndian" : "LittleEndian"; QString byte_order = b == 0 ? "BigEndian" : "LittleEndian";
QString tag = device + "_" + byte_order; QString tag = device + QLatin1Char('_') + byte_order;
for (int e=0; e<noOfElements; e++) { for (int e=0; e<noOfElements; e++) {
QTest::newRow(qPrintable(tag + QString("_%1").arg(e))) << device << QString(byte_order); QTest::newRow(qPrintable(tag + QString("_%1").arg(e))) << device << QString(byte_order);
} }

View File

@ -1063,7 +1063,7 @@ void tst_QDir::cd_data()
QTest::addColumn<bool>("successExpected"); QTest::addColumn<bool>("successExpected");
QTest::addColumn<QString>("newDir"); QTest::addColumn<QString>("newDir");
int index = m_dataPath.lastIndexOf("/"); int index = m_dataPath.lastIndexOf(QLatin1Char('/'));
QTest::newRow("cdUp") << m_dataPath << ".." << true << m_dataPath.left(index==0?1:index); QTest::newRow("cdUp") << m_dataPath << ".." << true << m_dataPath.left(index==0?1:index);
QTest::newRow("cdUp non existent (relative dir)") << "anonexistingDir" << ".." QTest::newRow("cdUp non existent (relative dir)") << "anonexistingDir" << ".."
<< true << m_dataPath; << true << m_dataPath;
@ -1107,11 +1107,11 @@ void tst_QDir::setNameFilters_data()
QTest::newRow("spaces2") << m_dataPath + "/testdir/spaces" << QStringList("*.bar") QTest::newRow("spaces2") << m_dataPath + "/testdir/spaces" << QStringList("*.bar")
<< QStringList("foo.bar"); << QStringList("foo.bar");
QTest::newRow("spaces3") << m_dataPath + "/testdir/spaces" << QStringList("foo.*") QTest::newRow("spaces3") << m_dataPath + "/testdir/spaces" << QStringList("foo.*")
<< QString("foo. bar,foo.bar").split(","); << QString("foo. bar,foo.bar").split(QLatin1Char(','));
QTest::newRow("files1") << m_dataPath + "/testdir/dir" << QString("*r.cpp *.pro").split(" ") QTest::newRow("files1") << m_dataPath + "/testdir/dir" << QString("*r.cpp *.pro").split(QLatin1Char(' '))
<< QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(","); << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(QLatin1Char(','));
QTest::newRow("resources1") << QString(":/tst_qdir/resources/entryList") << QStringList("*.data") QTest::newRow("resources1") << QString(":/tst_qdir/resources/entryList") << QStringList("*.data")
<< QString("file1.data,file2.data,file3.data").split(','); << QString("file1.data,file2.data,file3.data").split(QLatin1Char(','));
} }
void tst_QDir::setNameFilters() void tst_QDir::setNameFilters()

View File

@ -1994,7 +1994,7 @@ void tst_QFile::longFileName()
QString line = ts.readLine(); QString line = ts.readLine();
QCOMPARE(line, fileName); QCOMPARE(line, fileName);
} }
QString newName = fileName + QLatin1String("1"); QString newName = fileName + QLatin1Char('1');
{ {
QVERIFY(QFile::copy(fileName, newName)); QVERIFY(QFile::copy(fileName, newName));
QFile file(newName); QFile file(newName);

View File

@ -1065,7 +1065,7 @@ void tst_QFileInfo::consistent()
QFileInfo fi(file); QFileInfo fi(file);
QCOMPARE(fi.filePath(), expected); QCOMPARE(fi.filePath(), expected);
QCOMPARE(fi.dir().path() + "/" + fi.fileName(), expected); QCOMPARE(fi.dir().path() + QLatin1Char('/') + fi.fileName(), expected);
} }

View File

@ -1421,11 +1421,11 @@ void tst_QProcess::spaceArgsTest()
QCOMPARE(actual, args); QCOMPARE(actual, args);
#endif #endif
if (program.contains(" ")) if (program.contains(QLatin1Char(' ')))
program = "\"" + program + "\""; program = QLatin1Char('"') + program + QLatin1Char('"');
if (!stringArgs.isEmpty()) if (!stringArgs.isEmpty())
program += QString::fromLatin1(" ") + stringArgs; program += QLatin1Char(' ') + stringArgs;
errorMessage.clear(); errorMessage.clear();
process->start(program); process->start(program);
@ -1479,9 +1479,9 @@ void tst_QProcess::nativeArguments()
char buf[256]; char buf[256];
fgets(buf, 256, file); fgets(buf, 256, file);
fclose(file); fclose(file);
QStringList actual = QString::fromLatin1(buf).split("|"); QStringList actual = QString::fromLatin1(buf).split(QLatin1Char('|'));
#else #else
QStringList actual = QString::fromLatin1(proc.readAll()).split("|"); QStringList actual = QString::fromLatin1(proc.readAll()).split(QLatin1Char('|'));
#endif #endif
QVERIFY(!actual.isEmpty()); QVERIFY(!actual.isEmpty());
// not interested in the program name, it might be different. // not interested in the program name, it might be different.

View File

@ -211,7 +211,7 @@ static QString settingsPath(const char *path = "")
#else #else
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation); QString tempPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
#endif #endif
if (tempPath.endsWith("/")) if (tempPath.endsWith(QLatin1Char('/')))
tempPath.truncate(tempPath.size() - 1); tempPath.truncate(tempPath.size() - 1);
return QDir::toNativeSeparators(tempPath + "/tst_QSettings/" + QLatin1String(path)); return QDir::toNativeSeparators(tempPath + "/tst_QSettings/" + QLatin1String(path));
} }

View File

@ -1615,18 +1615,18 @@ void tst_QTextStream::forcePoint()
{ {
QString str; QString str;
QTextStream stream(&str); QTextStream stream(&str);
stream << fixed << forcepoint << 1.0 << " " << 1 << " " << 0 << " " << -1.0 << " " << -1; stream << fixed << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1;
QCOMPARE(str, QString("1.000000 1 0 -1.000000 -1")); QCOMPARE(str, QString("1.000000 1 0 -1.000000 -1"));
str.clear(); str.clear();
stream.seek(0); stream.seek(0);
stream << scientific << forcepoint << 1.0 << " " << 1 << " " << 0 << " " << -1.0 << " " << -1; stream << scientific << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1;
QCOMPARE(str, QString("1.000000e+00 1 0 -1.000000e+00 -1")); QCOMPARE(str, QString("1.000000e+00 1 0 -1.000000e+00 -1"));
str.clear(); str.clear();
stream.seek(0); stream.seek(0);
stream.setRealNumberNotation(QTextStream::SmartNotation); stream.setRealNumberNotation(QTextStream::SmartNotation);
stream << forcepoint << 1.0 << " " << 1 << " " << 0 << " " << -1.0 << " " << -1; stream << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1;
QCOMPARE(str, QString("1.00000 1 0 -1.00000 -1")); QCOMPARE(str, QString("1.00000 1 0 -1.00000 -1"));
} }
@ -1636,7 +1636,7 @@ void tst_QTextStream::forceSign()
{ {
QString str; QString str;
QTextStream stream(&str); QTextStream stream(&str);
stream << forcesign << 1.2 << " " << -1.2 << " " << 0; stream << forcesign << 1.2 << ' ' << -1.2 << ' ' << 0;
QCOMPARE(str, QString("+1.2 -1.2 +0")); QCOMPARE(str, QString("+1.2 -1.2 +0"));
} }
@ -1773,9 +1773,9 @@ void tst_QTextStream::nanInf()
QString s; QString s;
QTextStream out(&s); QTextStream out(&s);
out << qInf() << " " << -qInf() << " " << qQNaN() out << qInf() << ' ' << -qInf() << ' ' << qQNaN()
<< uppercasedigits << " " << uppercasedigits << ' '
<< qInf() << " " << -qInf() << " " << qQNaN() << qInf() << ' ' << -qInf() << ' ' << qQNaN()
<< flush; << flush;
QCOMPARE(s, QString("inf -inf nan INF -INF NAN")); QCOMPARE(s, QString("inf -inf nan INF -INF NAN"));
@ -2565,7 +2565,7 @@ void tst_QTextStream::useCase1()
stream.setCodec(QTextCodec::codecForName("ISO-8859-1")); stream.setCodec(QTextCodec::codecForName("ISO-8859-1"));
stream.setAutoDetectUnicode(true); stream.setAutoDetectUnicode(true);
stream << 4.15 << " " << QByteArray("abc") << " " << QString("ole"); stream << 4.15 << ' ' << QByteArray("abc") << ' ' << QString("ole");
} }
file.seek(0); file.seek(0);
@ -2601,7 +2601,7 @@ void tst_QTextStream::useCase2()
stream.setCodec(QTextCodec::codecForName("ISO-8859-1")); stream.setCodec(QTextCodec::codecForName("ISO-8859-1"));
stream.setAutoDetectUnicode(true); stream.setAutoDetectUnicode(true);
stream << 4.15 << " " << QByteArray("abc") << " " << QString("ole"); stream << 4.15 << ' ' << QByteArray("abc") << ' ' << QString("ole");
file.close(); file.close();
QVERIFY(file.open(QFile::ReadWrite)); QVERIFY(file.open(QFile::ReadWrite));

View File

@ -103,7 +103,7 @@ static QByteArray prettyList(const T &items)
first = false; first = false;
result += prettyPair(it); result += prettyPair(it);
} }
result += ")"; result += QLatin1Char(')');
return result.toLocal8Bit(); return result.toLocal8Bit();
} }

View File

@ -233,7 +233,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
{ {
if (QStringListModel *stringListModel = qobject_cast<QStringListModel *>(model)) { if (QStringListModel *stringListModel = qobject_cast<QStringListModel *>(model)) {
QString alphabet = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"; QString alphabet = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z";
stringListModel->setStringList( alphabet.split(",") ); stringListModel->setStringList( alphabet.split(QLatin1Char(',')) );
return QModelIndex(); return QModelIndex();
} }

View File

@ -1346,14 +1346,14 @@ void tst_QSortFilterProxyModel::buildHierarchy(const QStringList &l, QAbstractIt
QStack<QModelIndex> parent_stack; QStack<QModelIndex> parent_stack;
for (int i = 0; i < l.count(); ++i) { for (int i = 0; i < l.count(); ++i) {
QString token = l.at(i); QString token = l.at(i);
if (token == "<") { // start table if (token == QLatin1String("<")) { // start table
++ind; ++ind;
parent_stack.push(parent); parent_stack.push(parent);
row_stack.push(row); row_stack.push(row);
parent = m->index(row - 1, 0, parent); parent = m->index(row - 1, 0, parent);
row = 0; row = 0;
QVERIFY(m->insertColumns(0, 1, parent)); // add column QVERIFY(m->insertColumns(0, 1, parent)); // add column
} else if (token == ">") { // end table } else if (token == QLatin1String(">")) { // end table
--ind; --ind;
parent = parent_stack.pop(); parent = parent_stack.pop();
row = row_stack.pop(); row = row_stack.pop();
@ -1376,14 +1376,14 @@ void tst_QSortFilterProxyModel::checkHierarchy(const QStringList &l, const QAbst
QStack<QModelIndex> parent_stack; QStack<QModelIndex> parent_stack;
for (int i = 0; i < l.count(); ++i) { for (int i = 0; i < l.count(); ++i) {
QString token = l.at(i); QString token = l.at(i);
if (token == "<") { // start table if (token == QLatin1String("<")) { // start table
++indent; ++indent;
parent_stack.push(parent); parent_stack.push(parent);
row_stack.push(row); row_stack.push(row);
parent = m->index(row - 1, 0, parent); parent = m->index(row - 1, 0, parent);
QVERIFY(parent.isValid()); QVERIFY(parent.isValid());
row = 0; row = 0;
} else if (token == ">") { // end table } else if (token == QLatin1String(">")) { // end table
--indent; --indent;
parent = parent_stack.pop(); parent = parent_stack.pop();
row = row_stack.pop(); row = row_stack.pop();
@ -1418,7 +1418,7 @@ void tst_QSortFilterProxyModel::filterTable()
filter.setFilterRegExp("9"); filter.setFilterRegExp("9");
for (int i = 0; i < filter.rowCount(); ++i) for (int i = 0; i < filter.rowCount(); ++i)
QVERIFY(filter.data(filter.index(i, 0)).toString().contains("9")); QVERIFY(filter.data(filter.index(i, 0)).toString().contains(QLatin1Char('9')));
} }
void tst_QSortFilterProxyModel::insertAfterSelect() void tst_QSortFilterProxyModel::insertAfterSelect()
@ -2625,7 +2625,7 @@ void tst_QSortFilterProxyModel::staticSorting()
QSortFilterProxyModel proxy; QSortFilterProxyModel proxy;
proxy.setSourceModel(&model); proxy.setSourceModel(&model);
proxy.setDynamicSortFilter(false); proxy.setDynamicSortFilter(false);
QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" "); QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(QLatin1Char(' '));
// prepare model // prepare model
QStandardItem *root = model.invisibleRootItem (); QStandardItem *root = model.invisibleRootItem ();
@ -2680,7 +2680,7 @@ void tst_QSortFilterProxyModel::staticSorting()
void tst_QSortFilterProxyModel::dynamicSorting() void tst_QSortFilterProxyModel::dynamicSorting()
{ {
QStringListModel model1; QStringListModel model1;
const QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" "); const QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(QLatin1Char(' '));
model1.setStringList(initial); model1.setStringList(initial);
QSortFilterProxyModel proxy1; QSortFilterProxyModel proxy1;
proxy1.setDynamicSortFilter(false); proxy1.setDynamicSortFilter(false);
@ -3078,7 +3078,7 @@ void tst_QSortFilterProxyModel::appearsAndSort()
void tst_QSortFilterProxyModel::unnecessaryDynamicSorting() void tst_QSortFilterProxyModel::unnecessaryDynamicSorting()
{ {
QStringListModel model; QStringListModel model;
const QStringList initial = QString("bravo charlie delta echo").split(" "); const QStringList initial = QString("bravo charlie delta echo").split(QLatin1Char(' '));
model.setStringList(initial); model.setStringList(initial);
QSortFilterProxyModel proxy; QSortFilterProxyModel proxy;
proxy.setDynamicSortFilter(false); proxy.setDynamicSortFilter(false);
@ -3162,7 +3162,7 @@ private:
void tst_QSortFilterProxyModel::testMultipleProxiesWithSelection() void tst_QSortFilterProxyModel::testMultipleProxiesWithSelection()
{ {
QStringListModel model; QStringListModel model;
const QStringList initial = QString("bravo charlie delta echo").split(" "); const QStringList initial = QString("bravo charlie delta echo").split(QLatin1Char(' '));
model.setStringList(initial); model.setStringList(initial);
QSortFilterProxyModel proxy; QSortFilterProxyModel proxy;
@ -3196,7 +3196,7 @@ static bool isValid(const QItemSelection &selection)
void tst_QSortFilterProxyModel::mapSelectionFromSource() void tst_QSortFilterProxyModel::mapSelectionFromSource()
{ {
QStringListModel model; QStringListModel model;
const QStringList initial = QString("bravo charlie delta echo").split(" "); const QStringList initial = QString("bravo charlie delta echo").split(QLatin1Char(' '));
model.setStringList(initial); model.setStringList(initial);
QSortFilterProxyModel proxy; QSortFilterProxyModel proxy;

View File

@ -2555,8 +2555,8 @@ void tst_QtJson::nesting()
QVERIFY(!doc.isNull()); QVERIFY(!doc.isNull());
QCOMPARE(error.error, QJsonParseError::NoError); QCOMPARE(error.error, QJsonParseError::NoError);
json.prepend("["); json.prepend('[');
json.append("]"); json.append(']');
doc = QJsonDocument::fromJson(json, &error); doc = QJsonDocument::fromJson(json, &error);
QVERIFY(doc.isNull()); QVERIFY(doc.isNull());
@ -2574,8 +2574,8 @@ void tst_QtJson::nesting()
QVERIFY(!doc.isNull()); QVERIFY(!doc.isNull());
QCOMPARE(error.error, QJsonParseError::NoError); QCOMPARE(error.error, QJsonParseError::NoError);
json.prepend("["); json.prepend('[');
json.append("]"); json.append(']');
doc = QJsonDocument::fromJson(json, &error); doc = QJsonDocument::fromJson(json, &error);
QVERIFY(doc.isNull()); QVERIFY(doc.isNull());
@ -2589,7 +2589,7 @@ void tst_QtJson::longStrings()
// in the data structures (for Latin1String in qjson_p.h) // in the data structures (for Latin1String in qjson_p.h)
QString s(0x7ff0, 'a'); QString s(0x7ff0, 'a');
for (int i = 0x7ff0; i < 0x8010; i++) { for (int i = 0x7ff0; i < 0x8010; i++) {
s.append("c"); s.append(QLatin1Char('c'));
QMap <QString, QVariant> map; QMap <QString, QVariant> map;
map["key"] = s; map["key"] = s;
@ -2608,7 +2608,7 @@ void tst_QtJson::longStrings()
s = QString(0xfff0, 'a'); s = QString(0xfff0, 'a');
for (int i = 0xfff0; i < 0x10010; i++) { for (int i = 0xfff0; i < 0x10010; i++) {
s.append("c"); s.append(QLatin1Char('c'));
QMap <QString, QVariant> map; QMap <QString, QVariant> map;
map["key"] = s; map["key"] = s;

View File

@ -96,7 +96,7 @@
static QString sys_qualifiedLibraryName(const QString &fileName) static QString sys_qualifiedLibraryName(const QString &fileName)
{ {
QString appDir = QCoreApplication::applicationDirPath(); QString appDir = QCoreApplication::applicationDirPath();
return appDir + "/" + PREFIX + fileName + SUFFIX; return appDir + QLatin1Char('/') + PREFIX + fileName + SUFFIX;
} }
QT_FORWARD_DECLARE_CLASS(QLibrary) QT_FORWARD_DECLARE_CLASS(QLibrary)

View File

@ -3482,7 +3482,7 @@ template<class Container> void foreach_test_arrays(const Container &container)
void tst_Collections::foreach_2() void tst_Collections::foreach_2()
{ {
QStringList strlist = QString::fromLatin1("a,b,c,d,e,f,g,h,ih,kl,mn,op,qr,st,uvw,xyz").split(","); QStringList strlist = QString::fromLatin1("a,b,c,d,e,f,g,h,ih,kl,mn,op,qr,st,uvw,xyz").split(QLatin1Char(','));
foreach_test_arrays(strlist); foreach_test_arrays(strlist);
foreach_test_arrays(QList<QString>(strlist)); foreach_test_arrays(QList<QString>(strlist));
foreach_test_arrays(strlist.toVector()); foreach_test_arrays(strlist.toVector());

View File

@ -126,9 +126,9 @@ void tst_QBitArray::size()
for (int j=0; j<len; j++) { for (int j=0; j<len; j++) {
bool b = a[j]; bool b = a[j];
if (b) if (b)
S+= "1"; S+= QLatin1Char('1');
else else
S+= "0"; S+= QLatin1Char('0');
} }
QTEST(S,"res"); QTEST(S,"res");
} }

View File

@ -1984,15 +1984,15 @@ void tst_QByteArray::movablity()
QCOMPARE(array.isEmpty(), newIsEmpty); QCOMPARE(array.isEmpty(), newIsEmpty);
QCOMPARE(array.isNull(), newIsNull); QCOMPARE(array.isNull(), newIsNull);
QCOMPARE(array.capacity(), newCapacity); QCOMPARE(array.capacity(), newCapacity);
QVERIFY(array.startsWith("a")); QVERIFY(array.startsWith('a'));
QVERIFY(array.endsWith("b")); QVERIFY(array.endsWith('b'));
QCOMPARE(copy.size(), newSize); QCOMPARE(copy.size(), newSize);
QCOMPARE(copy.isEmpty(), newIsEmpty); QCOMPARE(copy.isEmpty(), newIsEmpty);
QCOMPARE(copy.isNull(), newIsNull); QCOMPARE(copy.isNull(), newIsNull);
QCOMPARE(copy.capacity(), newCapacity); QCOMPARE(copy.capacity(), newCapacity);
QVERIFY(copy.startsWith("a")); QVERIFY(copy.startsWith('a'));
QVERIFY(copy.endsWith("b")); QVERIFY(copy.endsWith('b'));
// try to not crash // try to not crash
array.squeeze(); array.squeeze();

View File

@ -756,7 +756,7 @@ void tst_QChar::normalization_data()
if (comment >= 0) if (comment >= 0)
line = line.left(comment); line = line.left(comment);
if (line.startsWith("@")) { if (line.startsWith('@')) {
if (line.startsWith("@Part") && line.size() > 5 && QChar(line.at(5)).isDigit()) if (line.startsWith("@Part") && line.size() > 5 && QChar(line.at(5)).isDigit())
part = QChar(line.at(5)).digitValue(); part = QChar(line.at(5)).digitValue();
continue; continue;

View File

@ -1047,7 +1047,7 @@ void tst_QDate::fromStringFormat_data()
QTest::newRow("data14") << QString("132") << QString("Md") << invalidDate(); QTest::newRow("data14") << QString("132") << QString("Md") << invalidDate();
QTest::newRow("data15") << february << QString("MMMM") << QDate(defDate().year(), 2, 1); QTest::newRow("data15") << february << QString("MMMM") << QDate(defDate().year(), 2, 1);
QString date = mon + " " + august + " 8 2005"; QString date = mon + QLatin1Char(' ') + august + " 8 2005";
QTest::newRow("data16") << date << QString("ddd MMMM d yyyy") << QDate(2005, 8, 8); QTest::newRow("data16") << date << QString("ddd MMMM d yyyy") << QDate(2005, 8, 8);
QTest::newRow("data17") << QString("2000:00") << QString("yyyy:yy") << QDate(2000, 1, 1); QTest::newRow("data17") << QString("2000:00") << QString("yyyy:yy") << QDate(2000, 1, 1);
QTest::newRow("data18") << QString("1999:99") << QString("yyyy:yy") << QDate(1999, 1, 1); QTest::newRow("data18") << QString("1999:99") << QString("yyyy:yy") << QDate(1999, 1, 1);

View File

@ -2096,11 +2096,11 @@ void tst_QDateTime::fromStringStringFormat_data()
QTest::newRow("data9") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data9") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime());
QTest::newRow("data10") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data10") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime());
QTest::newRow("data11") << date << QString("dd MMM yy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data11") << date << QString("dd MMM yy") << QDateTime(QDate(1910, 10, 10), QTime());
date = fri + " " + december + " 3 2004"; date = fri + QLatin1Char(' ') + december + " 3 2004";
QTest::newRow("data12") << date << QString("ddd MMMM d yyyy") << QDateTime(QDate(2004, 12, 3), QTime()); QTest::newRow("data12") << date << QString("ddd MMMM d yyyy") << QDateTime(QDate(2004, 12, 3), QTime());
QTest::newRow("data13") << QString("30.02.2004") << QString("dd.MM.yyyy") << invalidDateTime(); QTest::newRow("data13") << QString("30.02.2004") << QString("dd.MM.yyyy") << invalidDateTime();
QTest::newRow("data14") << QString("32.01.2004") << QString("dd.MM.yyyy") << invalidDateTime(); QTest::newRow("data14") << QString("32.01.2004") << QString("dd.MM.yyyy") << invalidDateTime();
date = thu + " " + january + " 2004"; date = thu + QLatin1Char(' ') + january + " 2004";
QTest::newRow("data15") << date << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime()); QTest::newRow("data15") << date << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime());
QTest::newRow("data16") << QString("2005-06-28T07:57:30.001Z") QTest::newRow("data16") << QString("2005-06-28T07:57:30.001Z")
<< QString("yyyy-MM-ddThh:mm:ss.zZ") << QString("yyyy-MM-ddThh:mm:ss.zZ")

View File

@ -370,7 +370,7 @@ void tst_QLocale::ctor()
&& l.country() == QLocale::exp_country, \ && l.country() == QLocale::exp_country, \
QString("requested: \"" + QString(req_lc) + "\", got: " \ QString("requested: \"" + QString(req_lc) + "\", got: " \
+ QLocale::languageToString(l.language()) \ + QLocale::languageToString(l.language()) \
+ "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \
QCOMPARE(l, QLocale(QLocale::exp_lang, QLocale::exp_country)); \ QCOMPARE(l, QLocale(QLocale::exp_lang, QLocale::exp_country)); \
QCOMPARE(qHash(l), qHash(QLocale(QLocale::exp_lang, QLocale::exp_country))); \ QCOMPARE(qHash(l), qHash(QLocale(QLocale::exp_lang, QLocale::exp_country))); \
} }
@ -431,8 +431,8 @@ void tst_QLocale::ctor()
&& l.country() == QLocale::exp_country, \ && l.country() == QLocale::exp_country, \
QString("requested: \"" + QString(req_lc) + "\", got: " \ QString("requested: \"" + QString(req_lc) + "\", got: " \
+ QLocale::languageToString(l.language()) \ + QLocale::languageToString(l.language()) \
+ "/" + QLocale::scriptToString(l.script()) \ + QLatin1Char('/') + QLocale::scriptToString(l.script()) \
+ "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \
} }
TEST_CTOR("zh_CN", Chinese, SimplifiedHanScript, China) TEST_CTOR("zh_CN", Chinese, SimplifiedHanScript, China)
@ -606,7 +606,7 @@ void tst_QLocale::legacyNames()
&& l.country() == QLocale::exp_country, \ && l.country() == QLocale::exp_country, \
QString("requested: \"" + QString(req_lc) + "\", got: " \ QString("requested: \"" + QString(req_lc) + "\", got: " \
+ QLocale::languageToString(l.language()) \ + QLocale::languageToString(l.language()) \
+ "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \
} }
TEST_CTOR("mo_MD", Romanian, Moldova) TEST_CTOR("mo_MD", Romanian, Moldova)
@ -1460,9 +1460,9 @@ void tst_QLocale::macDefaultLocale()
if (timeString.contains(QString("GMT"))) { if (timeString.contains(QString("GMT"))) {
QString expectedGMTSpecifierBase("GMT"); QString expectedGMTSpecifierBase("GMT");
if (diff >= 0) if (diff >= 0)
expectedGMTSpecifierBase.append("+"); expectedGMTSpecifierBase.append(QLatin1Char('+'));
else else
expectedGMTSpecifierBase.append("-"); expectedGMTSpecifierBase.append(QLatin1Char('-'));
QString expectedGMTSpecifier = expectedGMTSpecifierBase + QString("%1").arg(qAbs(diff)); QString expectedGMTSpecifier = expectedGMTSpecifierBase + QString("%1").arg(qAbs(diff));
QString expectedGMTSpecifierZeroExtended = expectedGMTSpecifierBase + QString("0%1").arg(qAbs(diff)); QString expectedGMTSpecifierZeroExtended = expectedGMTSpecifierBase + QString("0%1").arg(qAbs(diff));

View File

@ -1362,7 +1362,7 @@ void tst_QString::indexOf_data()
QString s2; QString s2;
s2 += QChar(0x3bc); s2 += QChar(0x3bc);
QTest::newRow( "data58" ) << s1 << s2 << 0 << false << 3; QTest::newRow( "data58" ) << s1 << s2 << 0 << false << 3;
s2.prepend("C"); s2.prepend(QLatin1Char('C'));
QTest::newRow( "data59" ) << s1 << s2 << 0 << false << 2; QTest::newRow( "data59" ) << s1 << s2 << 0 << false << 2;
QString veryBigHaystack(500, 'a'); QString veryBigHaystack(500, 'a');

View File

@ -292,7 +292,7 @@ void tst_QStringRef::indexOf_data()
QString s2; QString s2;
s2 += QChar(0x3bc); s2 += QChar(0x3bc);
QTest::newRow("data58") << QString(s1) << QString(s2) << 0 << false << 3; QTest::newRow("data58") << QString(s1) << QString(s2) << 0 << false << 3;
s2.prepend("C"); s2.prepend(QLatin1Char('C'));
QTest::newRow("data59") << QString(s1) << QString(s2) << 0 << false << 2; QTest::newRow("data59") << QString(s1) << QString(s2) << 0 << false << 2;
QString veryBigHaystack(500, 'a'); QString veryBigHaystack(500, 'a');

View File

@ -119,7 +119,7 @@ static QByteArray makeCanonical(const QString &filename,
if (notation.publicId().isEmpty()) { if (notation.publicId().isEmpty()) {
writeDtd << " SYSTEM \'"; writeDtd << " SYSTEM \'";
writeDtd << notation.systemId().toString(); writeDtd << notation.systemId().toString();
writeDtd << "\'"; writeDtd << '\'';
} else { } else {
writeDtd << " PUBLIC \'"; writeDtd << " PUBLIC \'";
writeDtd << notation.publicId().toString(); writeDtd << notation.publicId().toString();
@ -127,10 +127,10 @@ static QByteArray makeCanonical(const QString &filename,
if (!notation.systemId().isEmpty() ) { if (!notation.systemId().isEmpty() ) {
writeDtd << " \'"; writeDtd << " \'";
writeDtd << notation.systemId().toString(); writeDtd << notation.systemId().toString();
writeDtd << "\'"; writeDtd << '\'';
} }
} }
writeDtd << ">"; writeDtd << '>';
writeDtd << endl; writeDtd << endl;
} }
@ -687,7 +687,7 @@ QByteArray tst_QXmlStream::readFile(const QString &filename)
while (!reader.atEnd()) { while (!reader.atEnd()) {
reader.readNext(); reader.readNext();
writer << reader.tokenString() << "("; writer << reader.tokenString() << '(';
if (reader.isWhitespace()) if (reader.isWhitespace())
writer << " whitespace"; writer << " whitespace";
if (reader.isCDATA()) if (reader.isCDATA())
@ -695,42 +695,42 @@ QByteArray tst_QXmlStream::readFile(const QString &filename)
if (reader.isStartDocument() && reader.isStandaloneDocument()) if (reader.isStartDocument() && reader.isStandaloneDocument())
writer << " standalone"; writer << " standalone";
if (!reader.text().isEmpty()) if (!reader.text().isEmpty())
writer << " text=\"" << reader.text().toString() << "\""; writer << " text=\"" << reader.text().toString() << '"';
if (!reader.processingInstructionTarget().isEmpty()) if (!reader.processingInstructionTarget().isEmpty())
writer << " processingInstructionTarget=\"" << reader.processingInstructionTarget().toString() << "\""; writer << " processingInstructionTarget=\"" << reader.processingInstructionTarget().toString() << '"';
if (!reader.processingInstructionData().isEmpty()) if (!reader.processingInstructionData().isEmpty())
writer << " processingInstructionData=\"" << reader.processingInstructionData().toString() << "\""; writer << " processingInstructionData=\"" << reader.processingInstructionData().toString() << '"';
if (!reader.dtdName().isEmpty()) if (!reader.dtdName().isEmpty())
writer << " dtdName=\"" << reader.dtdName().toString() << "\""; writer << " dtdName=\"" << reader.dtdName().toString() << '"';
if (!reader.dtdPublicId().isEmpty()) if (!reader.dtdPublicId().isEmpty())
writer << " dtdPublicId=\"" << reader.dtdPublicId().toString() << "\""; writer << " dtdPublicId=\"" << reader.dtdPublicId().toString() << '"';
if (!reader.dtdSystemId().isEmpty()) if (!reader.dtdSystemId().isEmpty())
writer << " dtdSystemId=\"" << reader.dtdSystemId().toString() << "\""; writer << " dtdSystemId=\"" << reader.dtdSystemId().toString() << '"';
if (!reader.documentVersion().isEmpty()) if (!reader.documentVersion().isEmpty())
writer << " documentVersion=\"" << reader.documentVersion().toString() << "\""; writer << " documentVersion=\"" << reader.documentVersion().toString() << '"';
if (!reader.documentEncoding().isEmpty()) if (!reader.documentEncoding().isEmpty())
writer << " documentEncoding=\"" << reader.documentEncoding().toString() << "\""; writer << " documentEncoding=\"" << reader.documentEncoding().toString() << '"';
if (!reader.name().isEmpty()) if (!reader.name().isEmpty())
writer << " name=\"" << reader.name().toString() << "\""; writer << " name=\"" << reader.name().toString() << '"';
if (!reader.namespaceUri().isEmpty()) if (!reader.namespaceUri().isEmpty())
writer << " namespaceUri=\"" << reader.namespaceUri().toString() << "\""; writer << " namespaceUri=\"" << reader.namespaceUri().toString() << '"';
if (!reader.qualifiedName().isEmpty()) if (!reader.qualifiedName().isEmpty())
writer << " qualifiedName=\"" << reader.qualifiedName().toString() << "\""; writer << " qualifiedName=\"" << reader.qualifiedName().toString() << '"';
if (!reader.prefix().isEmpty()) if (!reader.prefix().isEmpty())
writer << " prefix=\"" << reader.prefix().toString() << "\""; writer << " prefix=\"" << reader.prefix().toString() << '"';
if (reader.attributes().size()) { if (reader.attributes().size()) {
foreach(QXmlStreamAttribute attribute, reader.attributes()) { foreach(QXmlStreamAttribute attribute, reader.attributes()) {
writer << endl << " Attribute("; writer << endl << " Attribute(";
if (!attribute.name().isEmpty()) if (!attribute.name().isEmpty())
writer << " name=\"" << attribute.name().toString() << "\""; writer << " name=\"" << attribute.name().toString() << '"';
if (!attribute.namespaceUri().isEmpty()) if (!attribute.namespaceUri().isEmpty())
writer << " namespaceUri=\"" << attribute.namespaceUri().toString() << "\""; writer << " namespaceUri=\"" << attribute.namespaceUri().toString() << '"';
if (!attribute.qualifiedName().isEmpty()) if (!attribute.qualifiedName().isEmpty())
writer << " qualifiedName=\"" << attribute.qualifiedName().toString() << "\""; writer << " qualifiedName=\"" << attribute.qualifiedName().toString() << '"';
if (!attribute.prefix().isEmpty()) if (!attribute.prefix().isEmpty())
writer << " prefix=\"" << attribute.prefix().toString() << "\""; writer << " prefix=\"" << attribute.prefix().toString() << '"';
if (!attribute.value().isEmpty()) if (!attribute.value().isEmpty())
writer << " value=\"" << attribute.value().toString() << "\""; writer << " value=\"" << attribute.value().toString() << '"';
writer << " )" << endl; writer << " )" << endl;
} }
} }
@ -738,9 +738,9 @@ QByteArray tst_QXmlStream::readFile(const QString &filename)
foreach(QXmlStreamNamespaceDeclaration namespaceDeclaration, reader.namespaceDeclarations()) { foreach(QXmlStreamNamespaceDeclaration namespaceDeclaration, reader.namespaceDeclarations()) {
writer << endl << " NamespaceDeclaration("; writer << endl << " NamespaceDeclaration(";
if (!namespaceDeclaration.prefix().isEmpty()) if (!namespaceDeclaration.prefix().isEmpty())
writer << " prefix=\"" << namespaceDeclaration.prefix().toString() << "\""; writer << " prefix=\"" << namespaceDeclaration.prefix().toString() << '"';
if (!namespaceDeclaration.namespaceUri().isEmpty()) if (!namespaceDeclaration.namespaceUri().isEmpty())
writer << " namespaceUri=\"" << namespaceDeclaration.namespaceUri().toString() << "\""; writer << " namespaceUri=\"" << namespaceDeclaration.namespaceUri().toString() << '"';
writer << " )" << endl; writer << " )" << endl;
} }
} }
@ -748,11 +748,11 @@ QByteArray tst_QXmlStream::readFile(const QString &filename)
foreach(QXmlStreamNotationDeclaration notationDeclaration, reader.notationDeclarations()) { foreach(QXmlStreamNotationDeclaration notationDeclaration, reader.notationDeclarations()) {
writer << endl << " NotationDeclaration("; writer << endl << " NotationDeclaration(";
if (!notationDeclaration.name().isEmpty()) if (!notationDeclaration.name().isEmpty())
writer << " name=\"" << notationDeclaration.name().toString() << "\""; writer << " name=\"" << notationDeclaration.name().toString() << '"';
if (!notationDeclaration.systemId().isEmpty()) if (!notationDeclaration.systemId().isEmpty())
writer << " systemId=\"" << notationDeclaration.systemId().toString() << "\""; writer << " systemId=\"" << notationDeclaration.systemId().toString() << '"';
if (!notationDeclaration.publicId().isEmpty()) if (!notationDeclaration.publicId().isEmpty())
writer << " publicId=\"" << notationDeclaration.publicId().toString() << "\""; writer << " publicId=\"" << notationDeclaration.publicId().toString() << '"';
writer << " )" << endl; writer << " )" << endl;
} }
} }
@ -760,15 +760,15 @@ QByteArray tst_QXmlStream::readFile(const QString &filename)
foreach(QXmlStreamEntityDeclaration entityDeclaration, reader.entityDeclarations()) { foreach(QXmlStreamEntityDeclaration entityDeclaration, reader.entityDeclarations()) {
writer << endl << " EntityDeclaration("; writer << endl << " EntityDeclaration(";
if (!entityDeclaration.name().isEmpty()) if (!entityDeclaration.name().isEmpty())
writer << " name=\"" << entityDeclaration.name().toString() << "\""; writer << " name=\"" << entityDeclaration.name().toString() << '"';
if (!entityDeclaration.notationName().isEmpty()) if (!entityDeclaration.notationName().isEmpty())
writer << " notationName=\"" << entityDeclaration.notationName().toString() << "\""; writer << " notationName=\"" << entityDeclaration.notationName().toString() << '"';
if (!entityDeclaration.systemId().isEmpty()) if (!entityDeclaration.systemId().isEmpty())
writer << " systemId=\"" << entityDeclaration.systemId().toString() << "\""; writer << " systemId=\"" << entityDeclaration.systemId().toString() << '"';
if (!entityDeclaration.publicId().isEmpty()) if (!entityDeclaration.publicId().isEmpty())
writer << " publicId=\"" << entityDeclaration.publicId().toString() << "\""; writer << " publicId=\"" << entityDeclaration.publicId().toString() << '"';
if (!entityDeclaration.value().isEmpty()) if (!entityDeclaration.value().isEmpty())
writer << " value=\"" << entityDeclaration.value().toString() << "\""; writer << " value=\"" << entityDeclaration.value().toString() << '"';
writer << " )" << endl; writer << " )" << endl;
} }
} }

View File

@ -260,11 +260,11 @@ void tst_QDBusType::isValidArray()
QFETCH(QString, data); QFETCH(QString, data);
QFETCH(bool, result); QFETCH(bool, result);
data.prepend("a"); data.prepend(QLatin1Char('a'));
QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result); QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result);
QCOMPARE(QDBusUtil::isValidSingleSignature(data), result); QCOMPARE(QDBusUtil::isValidSingleSignature(data), result);
data.prepend("a"); data.prepend(QLatin1Char('a'));
QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result); QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result);
QCOMPARE(QDBusUtil::isValidSingleSignature(data), result); QCOMPARE(QDBusUtil::isValidSingleSignature(data), result);
} }

View File

@ -141,7 +141,7 @@ void tst_QIcoImageFormat::canRead()
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(int, isValid); QFETCH(int, isValid);
QImageReader reader(m_IconPath + "/" + fileName); QImageReader reader(m_IconPath + QLatin1Char('/') + fileName);
QCOMPARE(reader.canRead(), (isValid == 0 ? false : true)); QCOMPARE(reader.canRead(), (isValid == 0 ? false : true));
} }
@ -175,7 +175,7 @@ void tst_QIcoImageFormat::SequentialFile()
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(int, isValid); QFETCH(int, isValid);
QSequentialFile *file = new QSequentialFile(m_IconPath + "/" + fileName); QSequentialFile *file = new QSequentialFile(m_IconPath + QLatin1Char('/') + fileName);
QVERIFY(file); QVERIFY(file);
QVERIFY(file->open(QFile::ReadOnly)); QVERIFY(file->open(QFile::ReadOnly));
QImageReader reader(file); QImageReader reader(file);
@ -212,7 +212,7 @@ void tst_QIcoImageFormat::imageCount()
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(int, count); QFETCH(int, count);
QImageReader reader(m_IconPath + "/" + fileName); QImageReader reader(m_IconPath + QLatin1Char('/') + fileName);
QCOMPARE(reader.imageCount(), count); QCOMPARE(reader.imageCount(), count);
} }
@ -240,7 +240,7 @@ void tst_QIcoImageFormat::jumpToNextImage()
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(int, count); QFETCH(int, count);
QImageReader reader(m_IconPath + "/" + fileName); QImageReader reader(m_IconPath + QLatin1Char('/') + fileName);
bool bJumped = reader.jumpToImage(0); bool bJumped = reader.jumpToImage(0);
while (bJumped) { while (bJumped) {
count--; count--;
@ -263,7 +263,7 @@ void tst_QIcoImageFormat::loopCount()
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(int, count); QFETCH(int, count);
QImageReader reader(m_IconPath + "/" + fileName); QImageReader reader(m_IconPath + QLatin1Char('/') + fileName);
QCOMPARE(reader.loopCount(), count); QCOMPARE(reader.loopCount(), count);
} }
@ -291,7 +291,7 @@ void tst_QIcoImageFormat::nextImageDelay()
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(int, count); QFETCH(int, count);
QImageReader reader(m_IconPath + "/" + fileName); QImageReader reader(m_IconPath + QLatin1Char('/') + fileName);
if (count == -1) { if (count == -1) {
QCOMPARE(reader.nextImageDelay(), 0); QCOMPARE(reader.nextImageDelay(), 0);
} else { } else {
@ -320,7 +320,7 @@ void tst_QIcoImageFormat::pngCompression()
QFETCH(int, width); QFETCH(int, width);
QFETCH(int, height); QFETCH(int, height);
QImageReader reader(m_IconPath + "/" + fileName); QImageReader reader(m_IconPath + QLatin1Char('/') + fileName);
QImage image; QImage image;
reader.jumpToImage(index); reader.jumpToImage(index);

View File

@ -158,7 +158,7 @@ private:
// helper to skip an autotest when the given image format is not supported // helper to skip an autotest when the given image format is not supported
#define SKIP_IF_UNSUPPORTED(format) do { \ #define SKIP_IF_UNSUPPORTED(format) do { \
if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \ if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \
QSKIP("\"" + QByteArray(format) + "\" images are not supported"); \ QSKIP('"' + QByteArray(format) + "\" images are not supported"); \
} while (0) } while (0)
// Testing get/set functions // Testing get/set functions

View File

@ -96,7 +96,7 @@ private:
// helper to skip an autotest when the given image format is not supported // helper to skip an autotest when the given image format is not supported
#define SKIP_IF_UNSUPPORTED(format) do { \ #define SKIP_IF_UNSUPPORTED(format) do { \
if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \ if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \
QSKIP("\"" + QByteArray(format) + "\" images are not supported"); \ QSKIP('"' + QByteArray(format) + "\" images are not supported"); \
} while (0) } while (0)
static void initializePadding(QImage *image) static void initializePadding(QImage *image)

View File

@ -1613,14 +1613,14 @@ void tst_QStandardItemModel::removeRowsAndColumns()
#define VERIFY_MODEL \ #define VERIFY_MODEL \
for (int c = 0; c < col_list.count(); c++) \ for (int c = 0; c < col_list.count(); c++) \
for (int r = 0; r < row_list.count(); r++) \ for (int r = 0; r < row_list.count(); r++) \
QCOMPARE(model.item(r,c)->text() , row_list[r] + "x" + col_list[c]); QCOMPARE(model.item(r,c)->text() , row_list[r] + QLatin1Char('x') + col_list[c]);
QVector<QString> row_list = QString("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").split(',').toVector(); QVector<QString> row_list = QString("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").split(',').toVector();
QVector<QString> col_list = row_list; QVector<QString> col_list = row_list;
QStandardItemModel model; QStandardItemModel model;
for (int c = 0; c < col_list.count(); c++) for (int c = 0; c < col_list.count(); c++)
for (int r = 0; r < row_list.count(); r++) for (int r = 0; r < row_list.count(); r++)
model.setItem(r, c, new QStandardItem(row_list[r] + "x" + col_list[c])); model.setItem(r, c, new QStandardItem(row_list[r] + QLatin1Char('x') + col_list[c]));
VERIFY_MODEL VERIFY_MODEL
row_list.remove(3); row_list.remove(3);
@ -1642,14 +1642,14 @@ void tst_QStandardItemModel::removeRowsAndColumns()
QList<QStandardItem *> row_taken = model.takeRow(6); QList<QStandardItem *> row_taken = model.takeRow(6);
QCOMPARE(row_taken.count(), col_list.count()); QCOMPARE(row_taken.count(), col_list.count());
for (int c = 0; c < col_list.count(); c++) for (int c = 0; c < col_list.count(); c++)
QCOMPARE(row_taken[c]->text() , row_list[6] + "x" + col_list[c]); QCOMPARE(row_taken[c]->text() , row_list[6] + QLatin1Char('x') + col_list[c]);
row_list.remove(6); row_list.remove(6);
VERIFY_MODEL VERIFY_MODEL
QList<QStandardItem *> col_taken = model.takeColumn(10); QList<QStandardItem *> col_taken = model.takeColumn(10);
QCOMPARE(col_taken.count(), row_list.count()); QCOMPARE(col_taken.count(), row_list.count());
for (int r = 0; r < row_list.count(); r++) for (int r = 0; r < row_list.count(); r++)
QCOMPARE(col_taken[r]->text() , row_list[r] + "x" + col_list[10]); QCOMPARE(col_taken[r]->text() , row_list[r] + QLatin1Char('x') + col_list[10]);
col_list.remove(10); col_list.remove(10);
VERIFY_MODEL VERIFY_MODEL
} }
@ -1661,7 +1661,7 @@ void tst_QStandardItemModel::itemRoleNames()
QStandardItemModel model; QStandardItemModel model;
for (int c = 0; c < col_list.count(); c++) for (int c = 0; c < col_list.count(); c++)
for (int r = 0; r < row_list.count(); r++) for (int r = 0; r < row_list.count(); r++)
model.setItem(r, c, new QStandardItem(row_list[r] + "x" + col_list[c])); model.setItem(r, c, new QStandardItem(row_list[r] + QLatin1Char('x') + col_list[c]));
VERIFY_MODEL VERIFY_MODEL
QHash<int, QByteArray> newRoleNames; QHash<int, QByteArray> newRoleNames;

View File

@ -380,7 +380,7 @@ void tst_QGuiVariant::toString_data()
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
<< QString( "Ctrl+A" ); << QString( "Ctrl+A" );
#else #else
<< QString(QChar(0x2318)) + "A"; << QString(QChar(0x2318)) + QLatin1Char('A');
#endif #endif
QFont font( "times", 12 ); QFont font( "times", 12 );

View File

@ -999,16 +999,16 @@ static QByteArray testnameForAxis(const QVector3D &axis)
testname = "null"; testname = "null";
} else { } else {
if (axis.x()) { if (axis.x()) {
testname += axis.x() < 0 ? "-" : "+"; testname += axis.x() < 0 ? '-' : '+';
testname += "X"; testname += 'X';
} }
if (axis.y()) { if (axis.y()) {
testname += axis.y() < 0 ? "-" : "+"; testname += axis.y() < 0 ? '-' : '+';
testname += "Y"; testname += 'Y';
} }
if (axis.z()) { if (axis.z()) {
testname += axis.z() < 0 ? "-" : "+"; testname += axis.z() < 0 ? '-' : '+';
testname += "Z"; testname += 'Z';
} }
} }
return testname; return testname;

View File

@ -185,7 +185,7 @@ static void debug(const QVector<QCss::Symbol> &symbols, int index = -1)
{ {
qDebug() << "all symbols:"; qDebug() << "all symbols:";
for (int i = 0; i < symbols.count(); ++i) for (int i = 0; i < symbols.count(); ++i)
qDebug() << "(" << i << "); Token:" << tokenName(symbols.at(i).token) << "; Lexem:" << symbols.at(i).lexem(); qDebug() << '(' << i << "); Token:" << tokenName(symbols.at(i).token) << "; Lexem:" << symbols.at(i).lexem();
if (index != -1) if (index != -1)
qDebug() << "failure at index" << index; qDebug() << "failure at index" << index;
} }
@ -1340,7 +1340,7 @@ void tst_QCssParser::shorthandBackgroundProperty()
QVERIFY(doc.setContent(QLatin1String("<!DOCTYPE test><test> <dummy/> </test>"))); QVERIFY(doc.setContent(QLatin1String("<!DOCTYPE test><test> <dummy/> </test>")));
css.prepend("dummy {"); css.prepend("dummy {");
css.append("}"); css.append(QLatin1Char('}'));
QCss::Parser parser(css); QCss::Parser parser(css);
QCss::StyleSheet sheet; QCss::StyleSheet sheet;
@ -1500,7 +1500,7 @@ void tst_QCssParser::gradient()
QVERIFY(doc.setContent(QLatin1String("<!DOCTYPE test><test> <dummy/> </test>"))); QVERIFY(doc.setContent(QLatin1String("<!DOCTYPE test><test> <dummy/> </test>")));
css.prepend("dummy {"); css.prepend("dummy {");
css.append("}"); css.append(QLatin1Char('}'));
QCss::Parser parser(css); QCss::Parser parser(css);
QCss::StyleSheet sheet; QCss::StyleSheet sheet;
@ -1560,7 +1560,7 @@ void tst_QCssParser::extractFontFamily()
{ {
QFETCH(QString, css); QFETCH(QString, css);
css.prepend("dummy {"); css.prepend("dummy {");
css.append("}"); css.append(QLatin1Char('}'));
QCss::Parser parser(css); QCss::Parser parser(css);
QCss::StyleSheet sheet; QCss::StyleSheet sheet;
@ -1618,7 +1618,7 @@ void tst_QCssParser::extractBorder()
QFETCH(QColor, expectedTopColor); QFETCH(QColor, expectedTopColor);
css.prepend("dummy {"); css.prepend("dummy {");
css.append("}"); css.append(QLatin1Char('}'));
QCss::Parser parser(css); QCss::Parser parser(css);
QCss::StyleSheet sheet; QCss::StyleSheet sheet;

View File

@ -1123,10 +1123,10 @@ void tst_QTextLayout::boundingRectTopLeft()
void tst_QTextLayout::graphemeBoundaryForSurrogatePairs() void tst_QTextLayout::graphemeBoundaryForSurrogatePairs()
{ {
QString txt; QString txt;
txt.append("a"); txt.append(QLatin1Char('a'));
txt.append(0xd87e); txt.append(0xd87e);
txt.append(0xdc25); txt.append(0xdc25);
txt.append("b"); txt.append(QLatin1Char('b'));
QTextLayout layout(txt); QTextLayout layout(txt);
QTextEngine *engine = layout.engine(); QTextEngine *engine = layout.engine();
const QCharAttributes *attrs = engine->attributes(); const QCharAttributes *attrs = engine->attributes();

View File

@ -130,7 +130,7 @@ struct ShapeTable {
static void prepareShapingTest(const QFont &font, const ShapeTable *shape_table) static void prepareShapingTest(const QFont &font, const ShapeTable *shape_table)
{ {
for (const ShapeTable *s = shape_table; s->unicode[0]; ++s) { for (const ShapeTable *s = shape_table; s->unicode[0]; ++s) {
QByteArray testName = font.family().toLatin1() + ":"; QByteArray testName = font.family().toLatin1() + ':';
QString string; QString string;
for (const ushort *u = s->unicode; *u; ++u) { for (const ushort *u = s->unicode; *u; ++u) {
string.append(QChar(*u)); string.append(QChar(*u));

View File

@ -2048,10 +2048,10 @@ bool tst_QFtp::dirExists( const QString &host, quint16 port, const QString &user
addCommand( QFtp::ConnectToHost, ftp->connectToHost( host, port ) ); addCommand( QFtp::ConnectToHost, ftp->connectToHost( host, port ) );
addCommand( QFtp::Login, ftp->login( user, password ) ); addCommand( QFtp::Login, ftp->login( user, password ) );
if ( dirToCreate.startsWith( "/" ) ) if ( dirToCreate.startsWith( QLatin1Char('/') ) )
addCommand( QFtp::Cd, ftp->cd( dirToCreate ) ); addCommand( QFtp::Cd, ftp->cd( dirToCreate ) );
else else
addCommand( QFtp::Cd, ftp->cd( cdDir + "/" + dirToCreate ) ); addCommand( QFtp::Cd, ftp->cd( cdDir + QLatin1Char('/') + dirToCreate ) );
addCommand( QFtp::Close, ftp->close() ); addCommand( QFtp::Close, ftp->close() );
inFileDirExistsFunction = true; inFileDirExistsFunction = true;

View File

@ -2780,7 +2780,7 @@ void tst_QNetworkReply::postToHttpsMultipart()
// hack for testing the setting of the content-type header by hand: // hack for testing the setting of the content-type header by hand:
if (contentType == "custom") { if (contentType == "custom") {
QByteArray contentType("multipart/custom; boundary=\"" + multiPart->boundary() + "\""); QByteArray contentType("multipart/custom; boundary=\"" + multiPart->boundary() + '"');
request.setHeader(QNetworkRequest::ContentTypeHeader, contentType); request.setHeader(QNetworkRequest::ContentTypeHeader, contentType);
} }
@ -2932,7 +2932,7 @@ void tst_QNetworkReply::connectToIPv6Address()
QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply));
QByteArray content = reply->readAll(); QByteArray content = reply->readAll();
//qDebug() << server.receivedData; //qDebug() << server.receivedData;
QByteArray hostinfo = "\r\nHost: " + hostfield + ":" + QByteArray::number(server.serverPort()) + "\r\n"; QByteArray hostinfo = "\r\nHost: " + hostfield + ':' + QByteArray::number(server.serverPort()) + "\r\n";
QVERIFY(server.receivedData.contains(hostinfo)); QVERIFY(server.receivedData.contains(hostinfo));
QCOMPARE(content, dataToSend); QCOMPARE(content, dataToSend);
QCOMPARE(reply->url(), request.url()); QCOMPARE(reply->url(), request.url());
@ -4943,7 +4943,7 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
const int allowedDeviation = 16; // TODO find out why the send rate is 13% faster currently const int allowedDeviation = 16; // TODO find out why the send rate is 13% faster currently
const int minRate = rate * 1024 * (100-allowedDeviation) / 100; const int minRate = rate * 1024 * (100-allowedDeviation) / 100;
const int maxRate = rate * 1024 * (100+allowedDeviation) / 100; const int maxRate = rate * 1024 * (100+allowedDeviation) / 100;
qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << "?"; qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << '?';
// The test takes too long to run if sending enough data to overwhelm the // The test takes too long to run if sending enough data to overwhelm the
// reciever's kernel buffers. // reciever's kernel buffers.
//QEXPECT_FAIL("http+limited", "Limiting is broken right now, check QTBUG-15065", Continue); //QEXPECT_FAIL("http+limited", "Limiting is broken right now, check QTBUG-15065", Continue);
@ -5519,7 +5519,7 @@ void tst_QNetworkReply::sendCookies_data()
list.clear(); list.clear();
cookie = QNetworkCookie("a", "b"); cookie = QNetworkCookie("a", "b");
cookie.setPath("/"); cookie.setPath("/");
cookie.setDomain("." + QtNetworkSettings::serverDomainName()); cookie.setDomain(QLatin1Char('.') + QtNetworkSettings::serverDomainName());
list << cookie; list << cookie;
QTest::newRow("domain-match") << list << "a=b"; QTest::newRow("domain-match") << list << "a=b";
@ -5852,7 +5852,7 @@ void tst_QNetworkReply::httpConnectionCount()
QCoreApplication::instance()->processEvents(); QCoreApplication::instance()->processEvents();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/" + QString::number(i))); QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + QLatin1Char('/') + QString::number(i)));
QNetworkReply* reply = manager.get(request); QNetworkReply* reply = manager.get(request);
reply->setParent(&server); reply->setParent(&server);
} }

View File

@ -141,7 +141,7 @@ void tst_QNetworkInterface::dump()
s.nospace() << ": " << qPrintable(e.ip().toString()); s.nospace() << ": " << qPrintable(e.ip().toString());
if (!e.netmask().isNull()) if (!e.netmask().isNull())
s.nospace() << '/' << e.prefixLength() s.nospace() << '/' << e.prefixLength()
<< " (" << qPrintable(e.netmask().toString()) << ")"; << " (" << qPrintable(e.netmask().toString()) << ')';
if (!e.broadcast().isNull()) if (!e.broadcast().isNull())
s.nospace() << " broadcast " << qPrintable(e.broadcast().toString()); s.nospace() << " broadcast " << qPrintable(e.broadcast().toString());
} }

View File

@ -534,7 +534,7 @@ void tst_QLocalSocket::sendData()
if (server.hasPendingConnections()) { if (server.hasPendingConnections()) {
QString testLine = "test"; QString testLine = "test";
for (int i = 0; i < 50000; ++i) for (int i = 0; i < 50000; ++i)
testLine += "a"; testLine += QLatin1Char('a');
QLocalSocket *serverSocket = server.nextPendingConnection(); QLocalSocket *serverSocket = server.nextPendingConnection();
QVERIFY(serverSocket); QVERIFY(serverSocket);
QCOMPARE(serverSocket->state(), QLocalSocket::ConnectedState); QCOMPARE(serverSocket->state(), QLocalSocket::ConnectedState);
@ -1205,7 +1205,7 @@ void tst_QLocalSocket::verifyListenWithDescriptor()
QVERIFY2(server.fullServerName().at(0) == at, "abstract sockets should start with a '@'"); QVERIFY2(server.fullServerName().at(0) == at, "abstract sockets should start with a '@'");
} else { } else {
QCOMPARE(server.fullServerName(), path); QCOMPARE(server.fullServerName(), path);
if (path.contains(QLatin1String("/"))) { if (path.contains(QLatin1Char('/'))) {
QVERIFY2(server.serverName() == path.mid(path.lastIndexOf(QLatin1Char('/'))+1), "server name invalid short name"); QVERIFY2(server.serverName() == path.mid(path.lastIndexOf(QLatin1Char('/'))+1), "server name invalid short name");
} else { } else {
QVERIFY2(server.serverName() == path, "servier name doesn't match the path provided"); QVERIFY2(server.serverName() == path, "servier name doesn't match the path provided");

View File

@ -1776,7 +1776,7 @@ void tst_QTcpSocket::atEnd()
// Test server must use some vsFTPd 2.x.x version // Test server must use some vsFTPd 2.x.x version
QVERIFY2(greeting.length() == sizeof("220 (vsFTPd 2.x.x)")-1, qPrintable(greeting)); QVERIFY2(greeting.length() == sizeof("220 (vsFTPd 2.x.x)")-1, qPrintable(greeting));
QVERIFY2(greeting.startsWith("220 (vsFTPd 2."), qPrintable(greeting)); QVERIFY2(greeting.startsWith("220 (vsFTPd 2."), qPrintable(greeting));
QVERIFY2(greeting.endsWith(")"), qPrintable(greeting)); QVERIFY2(greeting.endsWith(QLatin1Char(')')), qPrintable(greeting));
delete socket; delete socket;
} }

View File

@ -1064,7 +1064,7 @@ QString tst_QSslCertificate::toString(const QList<QSslError>& errors)
QStringList errorStrings; QStringList errorStrings;
foreach (const QSslError& error, errors) { foreach (const QSslError& error, errors) {
errorStrings.append(QLatin1String("\"") + error.errorString() + QLatin1String("\"")); errorStrings.append(QLatin1Char('"') + error.errorString() + QLatin1Char('"'));
} }
return QLatin1String("[ ") + errorStrings.join(QLatin1String(", ")) + QLatin1String(" ]"); return QLatin1String("[ ") + errorStrings.join(QLatin1String(", ")) + QLatin1String(" ]");

View File

@ -149,9 +149,10 @@ void atWrapper::ftpMgetDone( bool error)
if ( mgetDirList.size() > 1 ) if ( mgetDirList.size() > 1 )
for ( int i = 1; i < mgetDirList.size(); ++i ) for ( int i = 1; i < mgetDirList.size(); ++i )
{ {
file = new QFile( QString( output ) + "/" + mgetDirList.at( 0 ) + "/" + mgetDirList.at( i ) ); file = new QFile( QString( output ) + QLatin1Char('/') + mgetDirList.at( 0 )
+ QLatin1Char('/') + mgetDirList.at( i ) );
if (file->open(QIODevice::WriteOnly)) { if (file->open(QIODevice::WriteOnly)) {
ftp.get( ftpBaseDir + "/" + mgetDirList.at( 0 ) + "/" + mgetDirList.at( i ), file ); ftp.get( ftpBaseDir + QLatin1Char('/') + mgetDirList.at( 0 ) + QLatin1Char('/') + mgetDirList.at( i ), file );
ftp.list(); //Only there to fill up a slot in the pendingCommands queue. ftp.list(); //Only there to fill up a slot in the pendingCommands queue.
while ( ftp.hasPendingCommands() ) while ( ftp.hasPendingCommands() )
QCoreApplication::instance()->processEvents(); QCoreApplication::instance()->processEvents();
@ -192,11 +193,11 @@ bool atWrapper::setupFTP()
QString dir = ""; QString dir = "";
ftpMkDir( ftpBaseDir ); ftpMkDir( ftpBaseDir );
ftpBaseDir += "/" + QLibraryInfo::buildKey(); ftpBaseDir += QLatin1Char('/') + QLibraryInfo::buildKey();
ftpMkDir( ftpBaseDir ); ftpMkDir( ftpBaseDir );
ftpBaseDir += "/" + QString( qVersion() ); ftpBaseDir += QLatin1Char('/') + QString( qVersion() );
ftpMkDir( ftpBaseDir ); ftpMkDir( ftpBaseDir );
@ -209,9 +210,9 @@ bool atWrapper::setupFTP()
{ {
i.next(); i.next();
//qDebug() << "Creating dir with key:" << i.key(); //qDebug() << "Creating dir with key:" << i.key();
ftpMkDir( ftpBaseDir + "/" + QString( i.key() ) + ".failed" ); ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".failed" );
ftpMkDir( ftpBaseDir + "/" + QString( i.key() ) + ".diff" ); ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".diff" );
if (!ftpMkDir( ftpBaseDir + "/" + QString( i.key() ) + ".baseline" )) if (!ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".baseline" ))
haveBaseline = false; haveBaseline = false;
} }
@ -226,7 +227,7 @@ bool atWrapper::setupFTP()
{ {
j.next(); j.next();
rmDirList.clear(); rmDirList.clear();
rmDirList << ftpBaseDir + "/" + j.key() + ".failed" + "/"; rmDirList << ftpBaseDir + QLatin1Char('/') + j.key() + ".failed/";
ftpRmDir( j.key() + ".failed" ); ftpRmDir( j.key() + ".failed" );
ftp.rmdir( j.key() + ".failed" ); ftp.rmdir( j.key() + ".failed" );
ftp.mkdir( j.key() + ".failed" ); ftp.mkdir( j.key() + ".failed" );
@ -236,7 +237,7 @@ bool atWrapper::setupFTP()
QCoreApplication::instance()->processEvents(); QCoreApplication::instance()->processEvents();
rmDirList.clear(); rmDirList.clear();
rmDirList << ftpBaseDir + "/" + j.key() + ".diff" + "/"; rmDirList << ftpBaseDir + QLatin1Char('/') + j.key() + ".diff/";
ftpRmDir( j.key() + ".diff" ); ftpRmDir( j.key() + ".diff" );
ftp.rmdir( j.key() + ".diff" ); ftp.rmdir( j.key() + ".diff" );
ftp.mkdir( j.key() + ".diff" ); ftp.mkdir( j.key() + ".diff" );
@ -396,7 +397,7 @@ void atWrapper::createBaseline()
for (int n = 0; n < list.size(); n++) for (int n = 0; n < list.size(); n++)
{ {
QFileInfo fileInfo = list.at( n ); QFileInfo fileInfo = list.at( n );
QFile file( QString( output ) + "/" + i.key() + "/" + fileInfo.fileName() ); QFile file( QString( output ) + QLatin1Char('/') + i.key() + QLatin1Char('/') + fileInfo.fileName() );
file.open( QIODevice::ReadOnly ); file.open( QIODevice::ReadOnly );
QByteArray fileData = file.readAll(); QByteArray fileData = file.readAll();
//qDebug() << "Sending up:" << fileInfo.fileName() << "with file size" << fileData.size(); //qDebug() << "Sending up:" << fileInfo.fileName() << "with file size" << fileData.size();
@ -470,9 +471,9 @@ bool atWrapper::diff( QString basedir, QString dir, QString target )
//Comparing the two specified files, and then uploading them to //Comparing the two specified files, and then uploading them to
//the ftp server if they differ //the ftp server if they differ
basedir += "/" + dir; basedir += QLatin1Char('/') + dir;
QString one = basedir + ".baseline/" + target; QString one = basedir + ".baseline/" + target;
QString two = basedir + "/" + target; QString two = basedir + QLatin1Char('/') + target;
QFile file( one ); QFile file( one );
@ -517,7 +518,7 @@ void atWrapper::uploadDiff( QString basedir, QString dir, QString filename )
qDebug() << basedir; qDebug() << basedir;
QImage im1( basedir + ".baseline/" + filename ); QImage im1( basedir + ".baseline/" + filename );
QImage im2( basedir + "/" + filename ); QImage im2( basedir + QLatin1Char('/') + filename );
QImage im3(im1.size(), QImage::Format_ARGB32); QImage im3(im1.size(), QImage::Format_ARGB32);
@ -591,16 +592,16 @@ bool atWrapper::loadConfig( QString path )
QDir::current().mkdir( output ); QDir::current().mkdir( output );
output += "/" + QLibraryInfo::buildKey(); output += QLatin1Char('/') + QLibraryInfo::buildKey();
QDir::current().mkdir( output ); QDir::current().mkdir( output );
output += "/" + QString( qVersion() ); output += QLatin1Char('/') + QString( qVersion() );
QDir::current().mkdir( output ); QDir::current().mkdir( output );
ftpBaseDir += "/" + QHostInfo::localHostName().split( "." ).first(); ftpBaseDir += QLatin1Char('/') + QHostInfo::localHostName().split( QLatin1Char('.') ).first();
/* /*

View File

@ -222,46 +222,46 @@ QDebug operator<<(QDebug d, const QNativeEvent &e)
QTextStream &operator<<(QTextStream &s, QNativeEvent *e) QTextStream &operator<<(QTextStream &s, QNativeEvent *e)
{ {
return s << e->eventId << " " << e->modifiers << " QNativeEvent"; return s << e->eventId << ' ' << e->modifiers << " QNativeEvent";
} }
QTextStream &operator<<(QTextStream &s, QNativeMouseEvent *e) QTextStream &operator<<(QTextStream &s, QNativeMouseEvent *e)
{ {
return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->modifiers << " " << e->toString(); return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->modifiers << ' ' << e->toString();
} }
QTextStream &operator<<(QTextStream &s, QNativeMouseMoveEvent *e) QTextStream &operator<<(QTextStream &s, QNativeMouseMoveEvent *e)
{ {
return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->modifiers << " " << e->toString(); return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->modifiers << ' ' << e->toString();
} }
QTextStream &operator<<(QTextStream &s, QNativeMouseButtonEvent *e) QTextStream &operator<<(QTextStream &s, QNativeMouseButtonEvent *e)
{ {
return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->button return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->button
<< " " << e->clickCount << " " << e->modifiers << " " << e->toString(); << ' ' << e->clickCount << ' ' << e->modifiers << ' ' << e->toString();
} }
QTextStream &operator<<(QTextStream &s, QNativeMouseDragEvent *e) QTextStream &operator<<(QTextStream &s, QNativeMouseDragEvent *e)
{ {
return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->button << " " << e->clickCount return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->button << ' ' << e->clickCount
<< " " << e->modifiers << " " << e->toString(); << ' ' << e->modifiers << ' ' << e->toString();
} }
QTextStream &operator<<(QTextStream &s, QNativeMouseWheelEvent *e) QTextStream &operator<<(QTextStream &s, QNativeMouseWheelEvent *e)
{ {
return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->delta return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->delta
<< " " << e->modifiers << " " << e->toString(); << ' ' << e->modifiers << ' ' << e->toString();
} }
QTextStream &operator<<(QTextStream &s, QNativeKeyEvent *e) QTextStream &operator<<(QTextStream &s, QNativeKeyEvent *e)
{ {
return s << e->eventId << " " << e->press << " " << e->nativeKeyCode << " " << e->character return s << e->eventId << ' ' << e->press << ' ' << e->nativeKeyCode << ' ' << e->character
<< " " << e->modifiers << " " << e->toString(); << ' ' << e->modifiers << ' ' << e->toString();
} }
QTextStream &operator<<(QTextStream &s, QNativeModifierEvent *e) QTextStream &operator<<(QTextStream &s, QNativeModifierEvent *e)
{ {
return s << e->eventId << " " << e->modifiers << " " << e->nativeKeyCode << " " << e->toString(); return s << e->eventId << ' ' << e->modifiers << ' ' << e->nativeKeyCode << ' ' << e->toString();
} }

View File

@ -72,7 +72,7 @@ protected:
currentName.chop(1); currentName.chop(1);
ok &= (msg.contains(", " + currentName) || msg.contains(", 0x0")); ok &= (msg.contains(", " + currentName) || msg.contains(", 0x0"));
} }
ok &= msg.endsWith(")"); ok &= msg.endsWith(QLatin1Char(')'));
QVERIFY2(ok, (QString::fromLatin1("Message is not correctly finished: '") + msg + '\'').toLatin1().constData()); QVERIFY2(ok, (QString::fromLatin1("Message is not correctly finished: '") + msg + '\'').toLatin1().constData());
} }

View File

@ -119,7 +119,7 @@ inline static QString qTableName(const QString& prefix, QSqlDatabase db)
QString tableStr; QString tableStr;
if (db.driverName().toLower().contains("ODBC")) if (db.driverName().toLower().contains("ODBC"))
tableStr += QLatin1String("_odbc"); tableStr += QLatin1String("_odbc");
return fixupTableName(QString(db.driver()->escapeIdentifier(prefix + tableStr + "_" + return fixupTableName(QString(db.driver()->escapeIdentifier(prefix + tableStr + QLatin1Char('_') +
qGetHostName(), QSqlDriver::TableName)),db); qGetHostName(), QSqlDriver::TableName)),db);
} }
@ -219,12 +219,12 @@ public:
} }
// construct a stupid unique name // construct a stupid unique name
QString cName = QString::number( counter++ ) + "_" + driver + "@"; QString cName = QString::number( counter++ ) + QLatin1Char('_') + driver + QLatin1Char('@');
cName += host.isEmpty() ? dbName : host; cName += host.isEmpty() ? dbName : host;
if ( port > 0 ) if ( port > 0 )
cName += ":" + QString::number( port ); cName += QLatin1Char(':') + QString::number( port );
db = QSqlDatabase::addDatabase( driver, cName ); db = QSqlDatabase::addDatabase( driver, cName );
@ -364,7 +364,7 @@ public:
// for debugging only: outputs the connection as string // for debugging only: outputs the connection as string
static QString dbToString( const QSqlDatabase db ) static QString dbToString( const QSqlDatabase db )
{ {
QString res = db.driverName() + "@"; QString res = db.driverName() + QLatin1Char('@');
if ( db.driverName().startsWith( "QODBC" ) || db.driverName().startsWith( "QOCI" ) ) { if ( db.driverName().startsWith( "QODBC" ) || db.driverName().startsWith( "QOCI" ) ) {
res += db.databaseName(); res += db.databaseName();
@ -373,7 +373,7 @@ public:
} }
if ( db.port() > 0 ) { if ( db.port() > 0 ) {
res += ":" + QString::number( db.port() ); res += QLatin1Char(':') + QString::number( db.port() );
} }
return res; return res;
@ -522,7 +522,7 @@ public:
result += '\''; result += '\'';
if(!err.driverText().isEmpty()) if(!err.driverText().isEmpty())
result += err.driverText() + "' || '"; result += err.driverText() + "' || '";
result += err.databaseText() + "'"; result += err.databaseText() + QLatin1Char('\'');
return result.toLocal8Bit(); return result.toLocal8Bit();
} }
@ -534,7 +534,7 @@ public:
result += '\''; result += '\'';
if(!err.driverText().isEmpty()) if(!err.driverText().isEmpty())
result += err.driverText() + "' || '"; result += err.driverText() + "' || '";
result += err.databaseText() + "'"; result += err.databaseText() + QLatin1Char('\'');
return result.toLocal8Bit(); return result.toLocal8Bit();
} }

View File

@ -217,7 +217,7 @@ struct FieldDef {
{ {
QString rt = typeName; QString rt = typeName;
rt.replace(QRegExp("\\s"), QString("_")); rt.replace(QRegExp("\\s"), QString("_"));
int i = rt.indexOf("("); int i = rt.indexOf(QLatin1Char('('));
if (i == -1) if (i == -1)
i = rt.length(); i = rt.length();
if (i > 20) if (i > 20)

View File

@ -79,7 +79,7 @@ void tst_QSqlDriver::recreateTestTables(QSqlDatabase db)
tst_Databases::safeDropTable( db, relTEST1 ); tst_Databases::safeDropTable( db, relTEST1 );
QString doubleField = (dbType == QSqlDriver::SQLite) ? "more_data double" : "more_data double(8,7)"; QString doubleField = (dbType == QSqlDriver::SQLite) ? "more_data double" : "more_data double(8,7)";
QVERIFY_SQL( q, exec("create table " + relTEST1 + QVERIFY_SQL( q, exec("create table " + relTEST1 +
" (id int not null primary key, name varchar(20), title_key int, another_title_key int, " + doubleField + ")")); " (id int not null primary key, name varchar(20), title_key int, another_title_key int, " + doubleField + QLatin1Char(')')));
QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(1, 'harry', 1, 2, 1.234567)")); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(1, 'harry', 1, 2, 1.234567)"));
QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(2, 'trond', 2, 1, 8.901234)")); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(2, 'trond', 2, 1, 8.901234)"));
QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(3, 'vohi', 1, 2, 5.678901)")); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(3, 'vohi', 1, 2, 5.678901)"));

View File

@ -959,14 +959,14 @@ void tst_QSqlQuery::value()
if (dbType == QSqlDriver::Interbase) if (dbType == QSqlDriver::Interbase)
QVERIFY( q.value( 1 ).toString().startsWith( "VarChar" + QString::number( i ) ) ); QVERIFY( q.value( 1 ).toString().startsWith( "VarChar" + QString::number( i ) ) );
else if ( q.value( 1 ).toString().right( 1 ) == " " ) else if ( q.value( 1 ).toString().endsWith(QLatin1Char(' ')))
QCOMPARE( q.value( 1 ).toString(), ( "VarChar" + QString::number( i ) + " " ) ); QCOMPARE( q.value( 1 ).toString(), ( "VarChar" + QString::number( i ) + " " ) );
else else
QCOMPARE( q.value( 1 ).toString(), ( "VarChar" + QString::number( i ) ) ); QCOMPARE( q.value( 1 ).toString(), ( "VarChar" + QString::number( i ) ) );
if (dbType == QSqlDriver::Interbase) if (dbType == QSqlDriver::Interbase)
QVERIFY( q.value( 2 ).toString().startsWith( "Char" + QString::number( i ) ) ); QVERIFY( q.value( 2 ).toString().startsWith( "Char" + QString::number( i ) ) );
else if ( q.value( 2 ).toString().right( 1 ) != " " ) else if (!q.value( 2 ).toString().endsWith(QLatin1Char(' ')))
QCOMPARE( q.value( 2 ).toString(), ( "Char" + QString::number( i ) ) ); QCOMPARE( q.value( 2 ).toString(), ( "Char" + QString::number( i ) ) );
else else
QCOMPARE( q.value( 2 ).toString(), ( "Char" + QString::number( i ) + " " ) ); QCOMPARE( q.value( 2 ).toString(), ( "Char" + QString::number( i ) + " " ) );
@ -3145,7 +3145,7 @@ void tst_QSqlQuery::sqlServerReturn0()
"SELECT * FROM "+tableName+" WHERE ID = 2 " "SELECT * FROM "+tableName+" WHERE ID = 2 "
"RETURN 0")); "RETURN 0"));
QVERIFY_SQL(q, exec("{CALL "+procName+"}")); QVERIFY_SQL(q, exec("{CALL " + procName + QLatin1Char('}')));
QVERIFY_SQL(q, next()); QVERIFY_SQL(q, next());
} }
@ -3162,7 +3162,7 @@ void tst_QSqlQuery::QTBUG_551()
TYPE IntType IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;\n\ TYPE IntType IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;\n\
TYPE VCType IS TABLE OF VARCHAR2(60) INDEX BY BINARY_INTEGER;\n\ TYPE VCType IS TABLE OF VARCHAR2(60) INDEX BY BINARY_INTEGER;\n\
PROCEDURE P (Inp IN IntType, Outp OUT VCType);\n\ PROCEDURE P (Inp IN IntType, Outp OUT VCType);\n\
END "+pkgname+";")); END "+ pkgname + QLatin1Char(';')));
QVERIFY_SQL(q, exec("CREATE OR REPLACE PACKAGE BODY "+pkgname+" IS\n\ QVERIFY_SQL(q, exec("CREATE OR REPLACE PACKAGE BODY "+pkgname+" IS\n\
PROCEDURE P (Inp IN IntType, Outp OUT VCType)\n\ PROCEDURE P (Inp IN IntType, Outp OUT VCType)\n\
@ -3172,7 +3172,7 @@ void tst_QSqlQuery::QTBUG_551()
Outp(2) := '2. Value is ' ||TO_CHAR(Inp(2));\n\ Outp(2) := '2. Value is ' ||TO_CHAR(Inp(2));\n\
Outp(3) := '3. Value is ' ||TO_CHAR(Inp(3));\n\ Outp(3) := '3. Value is ' ||TO_CHAR(Inp(3));\n\
END p;\n\ END p;\n\
END "+pkgname+";")); END " + pkgname + QLatin1Char(';')));
QVariantList inLst, outLst, res_outLst; QVariantList inLst, outLst, res_outLst;
@ -3310,7 +3310,7 @@ void tst_QSqlQuery::QTBUG_6421()
QVERIFY_SQL(q, exec("create index INDEX2 on "+tableName+" (COL2 desc)")); QVERIFY_SQL(q, exec("create index INDEX2 on "+tableName+" (COL2 desc)"));
QVERIFY_SQL(q, exec("create index INDEX3 on "+tableName+" (COL3 desc)")); QVERIFY_SQL(q, exec("create index INDEX3 on "+tableName+" (COL3 desc)"));
q.setForwardOnly(true); q.setForwardOnly(true);
QVERIFY_SQL(q, exec("select COLUMN_EXPRESSION from ALL_IND_EXPRESSIONS where TABLE_NAME='"+tableName+"'")); QVERIFY_SQL(q, exec("select COLUMN_EXPRESSION from ALL_IND_EXPRESSIONS where TABLE_NAME='" + tableName + QLatin1Char('\'')));
QVERIFY_SQL(q, next()); QVERIFY_SQL(q, next());
QCOMPARE(q.value(0).toString(), QLatin1String("\"COL1\"")); QCOMPARE(q.value(0).toString(), QLatin1String("\"COL1\""));
QVERIFY_SQL(q, next()); QVERIFY_SQL(q, next());
@ -3338,7 +3338,7 @@ void tst_QSqlQuery::QTBUG_6618()
"begin\n" "begin\n"
" raiserror('" + errorString + "', 16, 1)\n" " raiserror('" + errorString + "', 16, 1)\n"
"end\n" )); "end\n" ));
q.exec("{call " + qTableName("tst_raiseError", __FILE__, db) + "}"); q.exec("{call " + qTableName("tst_raiseError", __FILE__, db) + QLatin1Char('}'));
QVERIFY(q.lastError().text().contains(errorString)); QVERIFY(q.lastError().text().contains(errorString));
} }
@ -3430,7 +3430,7 @@ void tst_QSqlQuery::QTBUG_21884()
QStringList stList; QStringList stList;
QString tableName(qTableName("bug21884", __FILE__, db)); QString tableName(qTableName("bug21884", __FILE__, db));
stList << "create table " + tableName + "(id integer primary key, note string)"; stList << "create table " + tableName + "(id integer primary key, note string)";
stList << "select * from " + tableName + ";"; stList << "select * from " + tableName + QLatin1Char(';');
stList << "select * from " + tableName + "; \t\n\r"; stList << "select * from " + tableName + "; \t\n\r";
stList << "drop table " + tableName; stList << "drop table " + tableName;
@ -3984,7 +3984,7 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const
{ {
QSqlQuery q(db); QSqlQuery q(db);
QVERIFY_SQL(q, exec("DROP TABLE IF EXISTS " + tableName)); QVERIFY_SQL(q, exec("DROP TABLE IF EXISTS " + tableName));
QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id " + type + ")")); QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id " + type + ')'));
const int steps = 20; const int steps = 20;
const T increment = max / steps - min / steps; const T increment = max / steps - min / steps;
@ -4001,7 +4001,7 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const
q.bindValue(0, v); q.bindValue(0, v);
QVERIFY_SQL(q, exec()); QVERIFY_SQL(q, exec());
} else { } else {
QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (" + QString::number(v) + ")")); QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (" + QString::number(v) + QLatin1Char(')')));
} }
values[i] = v; values[i] = v;
v += increment; v += increment;

View File

@ -1115,7 +1115,7 @@ void tst_QSqlRelationalTableModel::casing()
QCOMPARE( rec.count(), 0); QCOMPARE( rec.count(), 0);
//try an owner that does exist //try an owner that does exist
rec = db.driver()->record(db.userName() + "." + qTableName("CASETEST1", db).toUpper()); rec = db.driver()->record(db.userName() + QLatin1Char('.') + qTableName("CASETEST1", db).toUpper());
QCOMPARE( rec.count(), 4); QCOMPARE( rec.count(), 4);
} }
QSqlRecord rec = db.driver()->record(qTableName("CASETEST1", db).toUpper()); QSqlRecord rec = db.driver()->record(qTableName("CASETEST1", db).toUpper());
@ -1464,13 +1464,13 @@ void tst_QSqlRelationalTableModel::psqlSchemaTest()
QSqlQuery q(db); QSqlQuery q(db);
QVERIFY_SQL(q, exec("create schema " + qTableName("QTBUG_5373", __FILE__, db))); QVERIFY_SQL(q, exec("create schema " + qTableName("QTBUG_5373", __FILE__, db)));
QVERIFY_SQL(q, exec("create schema " + qTableName("QTBUG_5373_s2", __FILE__, db))); QVERIFY_SQL(q, exec("create schema " + qTableName("QTBUG_5373_s2", __FILE__, db)));
QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373", __FILE__, db) + "." + qTableName("document", __FILE__, db) + QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373", __FILE__, db) + QLatin1Char('.') + qTableName("document", __FILE__, db) +
"(document_id int primary key, relatingid int, userid int)")); "(document_id int primary key, relatingid int, userid int)"));
QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373_s2", __FILE__, db) + "." + qTableName("user", __FILE__, db) + QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373_s2", __FILE__, db) + QLatin1Char('.') + qTableName("user", __FILE__, db) +
"(userid int primary key, username char(40))")); "(userid int primary key, username char(40))"));
model.setTable(qTableName("QTBUG_5373", __FILE__, db) + "." + qTableName("document", __FILE__, db)); model.setTable(qTableName("QTBUG_5373", __FILE__, db) + QLatin1Char('.') + qTableName("document", __FILE__, db));
model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + "." + qTableName("user", __FILE__, db), "userid", "username")); model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + QLatin1Char('.') + qTableName("user", __FILE__, db), "userid", "username"));
model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + "." + qTableName("user", __FILE__, db), "userid", "username")); model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + QLatin1Char('.') + qTableName("user", __FILE__, db), "userid", "username"));
QVERIFY_SQL(model, select()); QVERIFY_SQL(model, select());
model.setJoinMode(QSqlRelationalTableModel::LeftJoin); model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
@ -1515,14 +1515,14 @@ void tst_QSqlRelationalTableModel::relationOnFirstColumn()
//prepare test1 table //prepare test1 table
QSqlQuery q(db); QSqlQuery q(db);
QVERIFY_SQL(q, exec("CREATE TABLE " + testTable1 + " (val1 INTEGER, id1 INTEGER PRIMARY KEY);")); QVERIFY_SQL(q, exec("CREATE TABLE " + testTable1 + " (val1 INTEGER, id1 INTEGER PRIMARY KEY);"));
QVERIFY_SQL(q, exec("DELETE FROM " + testTable1 + ";")); QVERIFY_SQL(q, exec("DELETE FROM " + testTable1 + QLatin1Char(';')));
QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(1, 10);")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(1, 10);"));
QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(2, 20);")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(2, 20);"));
QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(3, 30);")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(3, 30);"));
//prepare test2 table //prepare test2 table
QVERIFY_SQL(q, exec("CREATE TABLE " + testTable2 + " (id INTEGER PRIMARY KEY, name TEXT);")); QVERIFY_SQL(q, exec("CREATE TABLE " + testTable2 + " (id INTEGER PRIMARY KEY, name TEXT);"));
QVERIFY_SQL(q, exec("DELETE FROM " + testTable2 + ";")); QVERIFY_SQL(q, exec("DELETE FROM " + testTable2 + QLatin1Char(';')));
QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (10, 'Hervanta');")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (10, 'Hervanta');"));
QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (20, 'Keskusta');")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (20, 'Keskusta');"));
QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (30, 'Annala');")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (30, 'Annala');"));

View File

@ -1987,7 +1987,7 @@ void tst_QSqlTableModel::tableModifyWithBlank()
//set a filter on the table so the only record we get is the one we just made //set a filter on the table so the only record we get is the one we just made
//I could just do another setData command, but I want to make sure the TableModel //I could just do another setData command, but I want to make sure the TableModel
//matches exactly what is stored in the database //matches exactly what is stored in the database
model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row model.setFilter("column1='" + timeString + QLatin1Char('\'')); //filter to get just the newly entered row
QVERIFY_SQL(model, select()); QVERIFY_SQL(model, select());
//Make sure we only get one record, and that it is the one we just made //Make sure we only get one record, and that it is the one we just made

View File

@ -296,7 +296,7 @@ bool TestCompiler::make( const QString &workPath, const QString &target, bool ex
bool TestCompiler::exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version ) bool TestCompiler::exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version )
{ {
QFileInfo f(destDir + "/" + targetName(buildType, exeName, version)); QFileInfo f(destDir + QLatin1Char('/') + targetName(buildType, exeName, version));
return f.exists(); return f.exists();
} }

View File

@ -956,7 +956,7 @@ void tst_QFiledialog::selectFiles()
QListView* listView = fd.findChild<QListView*>("listView"); QListView* listView = fd.findChild<QListView*>("listView");
QVERIFY(listView); QVERIFY(listView);
for (int i = 0; i < list.count(); ++i) { for (int i = 0; i < list.count(); ++i) {
fd.selectFile(fd.directory().path() + "/" + list.at(i)); fd.selectFile(fd.directory().path() + QLatin1Char('/') + list.at(i));
QTRY_VERIFY(!listView->selectionModel()->selectedRows().isEmpty()); QTRY_VERIFY(!listView->selectionModel()->selectedRows().isEmpty());
toSelect.append(listView->selectionModel()->selectedRows().last()); toSelect.append(listView->selectionModel()->selectedRows().last());
} }

View File

@ -514,7 +514,7 @@ protected:
path = parentIndex.child(source_row,0).data(Qt::DisplayRole).toString(); path = parentIndex.child(source_row,0).data(Qt::DisplayRole).toString();
do { do {
path = parentIndex.data(Qt::DisplayRole).toString() + "/" + path; path = parentIndex.data(Qt::DisplayRole).toString() + QLatin1Char('/') + path;
parentIndex = parentIndex.parent(); parentIndex = parentIndex.parent();
} while(parentIndex.isValid()); } while(parentIndex.isValid());
@ -897,7 +897,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
#else #else
QTest::qWait(500); QTest::qWait(500);
#endif #endif
QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QChar('/') + QLatin1String("g")); QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QLatin1String("/g"));
QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName()); QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName());
fd3.restoreState(fd.saveState()); fd3.restoreState(fd.saveState());

View File

@ -1097,7 +1097,7 @@ void tst_QFileSystemModel::permissions() // checks QTBUG-20503
QFETCH(bool, readOnly); QFETCH(bool, readOnly);
const QString tmp = flatDirTestPath; const QString tmp = flatDirTestPath;
const QString file = tmp + '/' + "f"; const QString file = tmp + QLatin1String("/f");
QVERIFY(createFiles(tmp, QStringList() << "f")); QVERIFY(createFiles(tmp, QStringList() << "f"));
QVERIFY(QFile::setPermissions(file, QFile::Permissions(permissions))); QVERIFY(QFile::setPermissions(file, QFile::Permissions(permissions)));

View File

@ -606,7 +606,7 @@ void tst_QMessageBox::detailsButtonText()
QAbstractButton* btn = NULL; QAbstractButton* btn = NULL;
foreach(btn, list) { foreach(btn, list) {
if (btn && (btn->inherits("QPushButton"))) { if (btn && (btn->inherits("QPushButton"))) {
if (btn->text().remove("&") != QMessageBox::tr("OK") if (btn->text().remove(QLatin1Char('&')) != QMessageBox::tr("OK")
&& btn->text() != QMessageBox::tr("Show Details...")) { && btn->text() != QMessageBox::tr("Show Details...")) {
QFAIL(qPrintable(QString("Unexpected messagebox button text: %1").arg(btn->text()))); QFAIL(qPrintable(QString("Unexpected messagebox button text: %1").arg(btn->text())));
} }

View File

@ -547,8 +547,8 @@ void tst_QWizard::setDefaultProperty()
// make sure the data structure is reasonable // make sure the data structure is reasonable
for (int i = 0; i < 200000; ++i) { for (int i = 0; i < 200000; ++i) {
wizard.setDefaultProperty("QLineEdit", QByteArray("x" + QByteArray::number(i)).constData(), 0); wizard.setDefaultProperty("QLineEdit", QByteArray('x' + QByteArray::number(i)).constData(), 0);
wizard.setDefaultProperty("QLabel", QByteArray("y" + QByteArray::number(i)).constData(), 0); wizard.setDefaultProperty("QLabel", QByteArray('y' + QByteArray::number(i)).constData(), 0);
} }
} }
@ -2115,7 +2115,7 @@ void tst_QWizard::combinations()
} }
if (minSizeTest) if (minSizeTest)
qDebug() << "minimum sizes" << reason.latin1() << ";" << wizard.minimumSizeHint() qDebug() << "minimum sizes" << reason.latin1() << ';' << wizard.minimumSizeHint()
<< otor.latin1() << refMinSize; << otor.latin1() << refMinSize;
if (imageTest) if (imageTest)

View File

@ -416,14 +416,14 @@ void tst_QDirModel::rowsAboutToBeRemoved_data()
bool tst_QDirModel::rowsAboutToBeRemoved_init(const QString &test_path, const QStringList &initial_files) bool tst_QDirModel::rowsAboutToBeRemoved_init(const QString &test_path, const QStringList &initial_files)
{ {
QString path = QDir::currentPath() + "/" + test_path; QString path = QDir::currentPath() + QLatin1Char('/') + test_path;
if (!QDir::current().mkdir(test_path) && false) { // FIXME if (!QDir::current().mkdir(test_path) && false) { // FIXME
qDebug() << "failed to create dir" << path; qDebug() << "failed to create dir" << path;
return false; return false;
} }
for (int i = 0; i < initial_files.count(); ++i) { for (int i = 0; i < initial_files.count(); ++i) {
QFile file(path + "/" + initial_files.at(i)); QFile file(path + QLatin1Char('/') + initial_files.at(i));
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
qDebug() << "failed to open file" << initial_files.at(i); qDebug() << "failed to open file" << initial_files.at(i);
return false; return false;
@ -443,7 +443,7 @@ bool tst_QDirModel::rowsAboutToBeRemoved_init(const QString &test_path, const QS
bool tst_QDirModel::rowsAboutToBeRemoved_cleanup(const QString &test_path) bool tst_QDirModel::rowsAboutToBeRemoved_cleanup(const QString &test_path)
{ {
QString path = QDir::currentPath() + "/" + test_path; QString path = QDir::currentPath() + QLatin1Char('/') + test_path;
QDir dir(path, "*", QDir::SortFlags(QDir::Name|QDir::IgnoreCase), QDir::Files); QDir dir(path, "*", QDir::SortFlags(QDir::Name|QDir::IgnoreCase), QDir::Files);
QStringList files = dir.entryList(); QStringList files = dir.entryList();
@ -584,8 +584,8 @@ void tst_QDirModel::filePath()
QString path = SRCDIR; QString path = SRCDIR;
#else #else
QString path = QFileInfo(SRCDIR).absoluteFilePath(); QString path = QFileInfo(SRCDIR).absoluteFilePath();
if (!path.endsWith("/")) if (!path.endsWith(QLatin1Char('/')))
path += "/"; path += QLatin1Char('/');
#endif #endif
QCOMPARE(model.filePath(index), path + QString( "test.lnk")); QCOMPARE(model.filePath(index), path + QString( "test.lnk"));
model.setResolveSymlinks(true); model.setResolveSymlinks(true);

View File

@ -2492,7 +2492,7 @@ void tst_QHeaderView::calculateAndCheck(int cppline, const int precalced_compare
QString msg = "semantic problem at " + QString(__FILE__) + " (" + sline + ")"; QString msg = "semantic problem at " + QString(__FILE__) + " (" + sline + ")";
msg += "\nThe *expected* result was : {" + istr(x[0]) + istr(x[1]) + istr(x[2]) + istr(x[3]) msg += "\nThe *expected* result was : {" + istr(x[0]) + istr(x[1]) + istr(x[2]) + istr(x[3])
+ istr(x[4]) + istr(x[5]) + istr(x[6], false) + "}"; + istr(x[4]) + istr(x[5]) + istr(x[6], false) + QLatin1Char('}');
msg += "\nThe calculated result was : {"; msg += "\nThe calculated result was : {";
msg += istr(chk_visual) + istr(chk_logical) + istr(chk_sizes) + istr(chk_hidden_size) msg += istr(chk_visual) + istr(chk_logical) + istr(chk_sizes) + istr(chk_hidden_size)
+ istr(chk_lookup_visual) + istr(chk_lookup_logical) + istr(header_lenght, false) + "};"; + istr(chk_lookup_visual) + istr(chk_lookup_logical) + istr(header_lenght, false) + "};";
@ -2570,7 +2570,7 @@ void tst_QHeaderView::additionalInit()
for (int i = 0; i < model->rowCount(); ++i) { for (int i = 0; i < model->rowCount(); ++i) {
model->setData(model->index(i, 0), QVariant(i)); model->setData(model->index(i, 0), QVariant(i));
s.setNum(i); s.setNum(i);
s += "."; s += QLatin1Char('.');
s += 'a' + (i % 25); s += 'a' + (i % 25);
model->setData(model->index(i, 1), QVariant(s)); model->setData(model->index(i, 1), QVariant(s));
} }

View File

@ -2083,7 +2083,7 @@ void tst_QListView::taskQTBUG_12308_wrongFlowLayout()
QListWidgetItem *item = new QListWidgetItem(); QListWidgetItem *item = new QListWidgetItem();
item->setText(QString("Item %L1").arg(i)); item->setText(QString("Item %L1").arg(i));
lw.addItem(item); lw.addItem(item);
if (!item->text().contains(QString::fromLatin1("1"))) if (!item->text().contains(QLatin1Char('1')))
item->setHidden(true); item->setHidden(true);
} }
lw.show(); lw.show();

View File

@ -4286,7 +4286,7 @@ void tst_QTreeView::testInitialFocus()
{ {
QTreeWidget treeWidget; QTreeWidget treeWidget;
treeWidget.setColumnCount(5); treeWidget.setColumnCount(5);
new QTreeWidgetItem(&treeWidget, QStringList(QString("1;2;3;4;5").split(";"))); new QTreeWidgetItem(&treeWidget, QStringList(QString("1;2;3;4;5").split(QLatin1Char(';'))));
treeWidget.setTreePosition(2); treeWidget.setTreePosition(2);
treeWidget.header()->hideSection(0); // make sure we skip hidden section(s) treeWidget.header()->hideSection(0); // make sure we skip hidden section(s)
treeWidget.header()->swapSections(1, 2); // make sure that we look for first visual index (and not first logical) treeWidget.header()->swapSections(1, 2); // make sure that we look for first visual index (and not first logical)

View File

@ -2007,7 +2007,7 @@ void tst_QTreeWidget::columnCount()
void tst_QTreeWidget::setHeaderLabels() void tst_QTreeWidget::setHeaderLabels()
{ {
QStringList list = QString("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z").split(","); QStringList list = QString("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z").split(QLatin1Char(','));
testWidget->setHeaderLabels(list); testWidget->setHeaderLabels(list);
QCOMPARE(testWidget->header()->count(), list.count()); QCOMPARE(testWidget->header()->count(), list.count());
} }

View File

@ -502,7 +502,7 @@ static QString cstrings2QString( char **args )
while ( args[i] ) { while ( args[i] ) {
string += args[i]; string += args[i];
if ( args[i+1] ) if ( args[i+1] )
string += " "; string += QLatin1Char(' ');
++i; ++i;
} }
return string; return string;
@ -1060,16 +1060,16 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2()
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
QByteArray validPath = QDir("/tmp").canonicalPath().toLatin1(); QByteArray validPath = QDir("/tmp").canonicalPath().toLatin1();
QByteArray nonExistentPath = "/nonexistent"; QByteArray nonExistentPath = "/nonexistent";
QByteArray pluginPath = validPath + ":" + nonExistentPath; QByteArray pluginPath = validPath + ':' + nonExistentPath;
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
# ifdef Q_OS_WINCE # ifdef Q_OS_WINCE
QByteArray validPath = "/Temp"; QByteArray validPath = "/Temp";
QByteArray nonExistentPath = "/nonexistent"; QByteArray nonExistentPath = "/nonexistent";
QByteArray pluginPath = validPath + ";" + nonExistentPath; QByteArray pluginPath = validPath + ';' + nonExistentPath;
# else # else
QByteArray validPath = "C:\\windows"; QByteArray validPath = "C:\\windows";
QByteArray nonExistentPath = "Z:\\nonexistent"; QByteArray nonExistentPath = "Z:\\nonexistent";
QByteArray pluginPath = validPath + ";" + nonExistentPath; QByteArray pluginPath = validPath + ';' + nonExistentPath;
# endif # endif
#endif #endif

View File

@ -195,7 +195,7 @@ void tst_QLayout::smartMaxSize()
int width = sz.width(); int width = sz.width();
int expectedWidth = expectedWidths[expectedIndex]; int expectedWidth = expectedWidths[expectedIndex];
if (width != expectedWidth) { if (width != expectedWidth) {
qDebug() << "error at index" << expectedIndex << ":" << sizePolicy.horizontalPolicy() << align << minSize << sizeHint << maxSize << width; qDebug() << "error at index" << expectedIndex << ':' << sizePolicy.horizontalPolicy() << align << minSize << sizeHint << maxSize << width;
++regressionCount; ++regressionCount;
} }
++expectedIndex; ++expectedIndex;

View File

@ -61,7 +61,7 @@ public:
protected: protected:
QStringList splitPath(const QString &path) const { QStringList splitPath(const QString &path) const {
return csv ? path.split(",") : QCompleter::splitPath(path); return csv ? path.split(QLatin1Char(',')) : QCompleter::splitPath(path);
} }
private: private:

View File

@ -259,7 +259,7 @@ bool BaselineHandler::establishConnection()
logMsg += key + QLS(": '") + clientInfo.value(key) + QLS("', "); logMsg += key + QLS(": '") + clientInfo.value(key) + QLS("', ");
} }
qDebug() << runId << logtime() << "Connection established with" << clientInfo.value(PI_HostName) qDebug() << runId << logtime() << "Connection established with" << clientInfo.value(PI_HostName)
<< "[" << qPrintable(clientInfo.value(PI_HostAddress)) << "]" << logMsg << '[' << qPrintable(clientInfo.value(PI_HostAddress)) << ']' << logMsg
<< "Overrides:" << clientInfo.overrides() << "AdHoc-Run:" << clientInfo.isAdHocRun(); << "Overrides:" << clientInfo.overrides() << "AdHoc-Run:" << clientInfo.isAdHocRun();
// ### Hardcoded backwards compatibility: add project field for certain existing clients that lack it // ### Hardcoded backwards compatibility: add project field for certain existing clients that lack it

View File

@ -309,7 +309,7 @@ void Report::writeFunctionResults(const ImageItemList &list)
out << "<span style=\"color:green\"><small>No mismatch reported</small></span>"; out << "<span style=\"color:green\"><small>No mismatch reported</small></span>";
break; break;
default: default:
out << "?"; out << '?';
break; break;
} }
out << "</td>\n"; out << "</td>\n";
@ -401,14 +401,14 @@ QString Report::writeResultsXmlFiles()
if (!cwd.exists(dir)) if (!cwd.exists(dir))
cwd.mkpath(dir); cwd.mkpath(dir);
foreach (const QString &func, itemLists.keys()) { foreach (const QString &func, itemLists.keys()) {
QFile f(dir + "/" + func + "-results.xml"); QFile f(dir + QLatin1Char('/') + func + "-results.xml");
if (!f.open(QIODevice::WriteOnly)) if (!f.open(QIODevice::WriteOnly))
continue; continue;
QXmlStreamWriter s(&f); QXmlStreamWriter s(&f);
s.setAutoFormatting(true); s.setAutoFormatting(true);
s.writeStartDocument(); s.writeStartDocument();
foreach (QString key, plat.keys()) { foreach (QString key, plat.keys()) {
QString cmt = " " + key + "=\"" + plat.value(key) +"\" "; QString cmt = QLatin1Char(' ') + key + "=\"" + plat.value(key) +"\" ";
s.writeComment(cmt.replace("--", "[-]")); s.writeComment(cmt.replace("--", "[-]"));
} }
s.writeStartElement("testsuite"); s.writeStartElement("testsuite");

View File

@ -56,11 +56,11 @@ void tst_QTextCodec::codecForName() const
QBENCHMARK { QBENCHMARK {
foreach(const QByteArray& c, codecs) { foreach(const QByteArray& c, codecs) {
QVERIFY(QTextCodec::codecForName(c)); QVERIFY(QTextCodec::codecForName(c));
QVERIFY(QTextCodec::codecForName(c + "-")); QVERIFY(QTextCodec::codecForName(c + '-'));
} }
foreach(const QByteArray& c, codecs) { foreach(const QByteArray& c, codecs) {
QVERIFY(QTextCodec::codecForName(c + "+")); QVERIFY(QTextCodec::codecForName(c + '+'));
QVERIFY(QTextCodec::codecForName(c + "*")); QVERIFY(QTextCodec::codecForName(c + '*'));
} }
} }
} }

View File

@ -602,7 +602,7 @@ void tst_qfile::createSmallFiles()
for (int i = 0; i < 1000; ++i) for (int i = 0; i < 1000; ++i)
#endif #endif
{ {
QFile f(tmpDirName+"/"+QString::number(i)); QFile f(tmpDirName + QLatin1Char('/') + QString::number(i));
f.open(QIODevice::WriteOnly); f.open(QIODevice::WriteOnly);
f.seek(511); f.seek(511);
f.putChar('\n'); f.putChar('\n');
@ -641,7 +641,7 @@ void tst_qfile::readSmallFiles()
case(QFileBenchmark): { case(QFileBenchmark): {
QList<QFile*> fileList; QList<QFile*> fileList;
Q_FOREACH(QString file, files) { Q_FOREACH(QString file, files) {
QFile *f = new QFile(tmpDirName+ "/" + file); QFile *f = new QFile(tmpDirName + QLatin1Char('/') + file);
f->open(QIODevice::ReadOnly|textMode|bufferedMode); f->open(QIODevice::ReadOnly|textMode|bufferedMode);
fileList.append(f); fileList.append(f);
} }
@ -664,7 +664,7 @@ void tst_qfile::readSmallFiles()
case(QFSFileEngineBenchmark): { case(QFSFileEngineBenchmark): {
QList<QFSFileEngine*> fileList; QList<QFSFileEngine*> fileList;
Q_FOREACH(QString file, files) { Q_FOREACH(QString file, files) {
QFSFileEngine *fse = new QFSFileEngine(tmpDirName+ "/" + file); QFSFileEngine *fse = new QFSFileEngine(tmpDirName + QLatin1Char('/') + file);
fse->open(QIODevice::ReadOnly|textMode|bufferedMode); fse->open(QIODevice::ReadOnly|textMode|bufferedMode);
fileList.append(fse); fileList.append(fse);
} }
@ -685,7 +685,7 @@ void tst_qfile::readSmallFiles()
case(PosixBenchmark): { case(PosixBenchmark): {
QList<FILE*> fileList; QList<FILE*> fileList;
Q_FOREACH(QString file, files) { Q_FOREACH(QString file, files) {
fileList.append(::fopen(QFile::encodeName(tmpDirName+ "/" + file).constData(), "rb")); fileList.append(::fopen(QFile::encodeName(tmpDirName + QLatin1Char('/') + file).constData(), "rb"));
} }
QBENCHMARK { QBENCHMARK {

View File

@ -100,7 +100,7 @@ bool readSettingsFromCommandLine(int argc, char *argv[],
return false; return false;
} }
else { else {
QStringList res = QString(argv[i+1]).split("x"); QStringList res = QString(argv[i+1]).split(QLatin1Char('x'));
if (res.count() != 2) { if (res.count() != 2) {
printf("-resolution parameter UI resolution should be set in format WxH where width and height are positive values\n"); printf("-resolution parameter UI resolution should be set in format WxH where width and height are positive values\n");
usage(argv[0]); usage(argv[0]);

View File

@ -81,7 +81,8 @@ QString DummyDataGenerator::randomPhoneNumber(QString indexNumber)
QString beginNumber = QString::number(555-index*2); QString beginNumber = QString::number(555-index*2);
QString endNumber = QString("0").repeated(4-indexNumber.length()) + indexNumber; QString endNumber = QString("0").repeated(4-indexNumber.length()) + indexNumber;
return countryCode +" " + areaCode +" " + beginNumber +" " + endNumber; return countryCode + QLatin1Char(' ') + areaCode +QLatin1Char(' ') + beginNumber
+ QLatin1Char(' ') + endNumber;
} }
QString DummyDataGenerator::randomFirstName() QString DummyDataGenerator::randomFirstName()

View File

@ -130,7 +130,7 @@ void BenchQHeaderView::init()
for (int i = 0; i < m_model->rowCount(); ++i) { for (int i = 0; i < m_model->rowCount(); ++i) {
m_model->setData(m_model->index(i, 0), QVariant(i)); m_model->setData(m_model->index(i, 0), QVariant(i));
s.setNum(i); s.setNum(i);
s += "."; s += QLatin1Char('.');
s += 'a' + (i % 25); s += 'a' + (i % 25);
m_model->setData(m_model->index(i, 1), QVariant(s)); m_model->setData(m_model->index(i, 1), QVariant(s));
} }

View File

@ -285,7 +285,7 @@ void tst_QSqlQuery::benchmarkSelectPrepared()
int expectedSum = 0; int expectedSum = 0;
QString fillQuery = "INSERT INTO " + tableName + " VALUES (0)"; QString fillQuery = "INSERT INTO " + tableName + " VALUES (0)";
for (int i = 1; i < NUM_ROWS; ++i) { for (int i = 1; i < NUM_ROWS; ++i) {
fillQuery += ", (" + QString::number(i) + ")"; fillQuery += ", (" + QString::number(i) + QLatin1Char(')');
expectedSum += i; expectedSum += i;
} }
QVERIFY_SQL(q, exec(fillQuery)); QVERIFY_SQL(q, exec(fillQuery));

View File

@ -147,7 +147,7 @@ void BearerEx::on_createSessionButton_clicked()
QNetworkConfiguration networkConfiguration = qvariant_cast<QNetworkConfiguration>(item->data(Qt::UserRole)); QNetworkConfiguration networkConfiguration = qvariant_cast<QNetworkConfiguration>(item->data(Qt::UserRole));
int newTabIndex = mainTabWidget->count(); int newTabIndex = mainTabWidget->count();
SessionTab* newTab = new SessionTab(&networkConfiguration,&m_NetworkConfigurationManager,eventListWidget,newTabIndex-1); SessionTab* newTab = new SessionTab(&networkConfiguration,&m_NetworkConfigurationManager,eventListWidget,newTabIndex-1);
QString label = QString("S")+QString::number(newTabIndex-1); QString label = QLatin1Char('S') + QString::number(newTabIndex-1);
mainTabWidget->insertTab(newTabIndex,newTab,label); mainTabWidget->insertTab(newTabIndex,newTab,label);
mainTabWidget->setCurrentIndex(newTabIndex); mainTabWidget->setCurrentIndex(newTabIndex);
} }
@ -271,9 +271,11 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration,
snapLabel->hide(); snapLabel->hide();
snapLineEdit->hide(); snapLineEdit->hide();
alrButton->hide(); alrButton->hide();
iapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")"); iapLineEdit->setText(apNetworkConfiguration->name()+ " (" + apNetworkConfiguration->identifier()
+ QLatin1Char(')'));
} else if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) { } else if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) {
snapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")"); snapLineEdit->setText(apNetworkConfiguration->name()+ " (" + apNetworkConfiguration->identifier()
+ QLatin1Char(')'));
} }
bearerLineEdit->setText(apNetworkConfiguration->bearerTypeName()); bearerLineEdit->setText(apNetworkConfiguration->bearerTypeName());
sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+
@ -380,7 +382,7 @@ void SessionTab::newConfigurationActivated()
msgBox.setDefaultButton(QMessageBox::Yes); msgBox.setDefaultButton(QMessageBox::Yes);
if (msgBox.exec() == QMessageBox::Yes) { if (msgBox.exec() == QMessageBox::Yes) {
m_NetworkSession->accept(); m_NetworkSession->accept();
iapLineEdit->setText(m_config.name()+" ("+m_config.identifier()+")"); iapLineEdit->setText(m_config.name() + " (" + m_config.identifier() + QLatin1Char(')'));
} else { } else {
m_NetworkSession->reject(); m_NetworkSession->reject();
} }
@ -391,7 +393,7 @@ void SessionTab::preferredConfigurationChanged(const QNetworkConfiguration& conf
m_config = config; m_config = config;
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText("Roaming to new configuration."); msgBox.setText("Roaming to new configuration.");
msgBox.setInformativeText("Do you want to migrate to "+config.name()+"?"); msgBox.setInformativeText("Do you want to migrate to " + config.name() + QLatin1Char('?'));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes); msgBox.setDefaultButton(QMessageBox::Yes);
if (msgBox.exec() == QMessageBox::Yes) { if (msgBox.exec() == QMessageBox::Yes) {
@ -407,7 +409,7 @@ void SessionTab::opened()
QFont font = listItem->font(); QFont font = listItem->font();
font.setBold(true); font.setBold(true);
listItem->setFont(font); listItem->setFont(font);
listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened")); listItem->setText(QLatin1Char('S') + QString::number(m_index) + QLatin1String(" - Opened"));
m_eventListWidget->addItem(listItem); m_eventListWidget->addItem(listItem);
QVariant identifier = m_NetworkSession->sessionProperty("ActiveConfiguration"); QVariant identifier = m_NetworkSession->sessionProperty("ActiveConfiguration");
@ -415,7 +417,7 @@ void SessionTab::opened()
QString configId = identifier.toString(); QString configId = identifier.toString();
QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
if (config.isValid()) { if (config.isValid()) {
iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); iapLineEdit->setText(config.name() + " (" + config.identifier() + QLatin1Char(')'));
} }
} }
newState(m_NetworkSession->state()); // Update the "(open)" newState(m_NetworkSession->state()); // Update the "(open)"
@ -438,7 +440,7 @@ void SessionTab::closed()
QFont font = listItem->font(); QFont font = listItem->font();
font.setBold(true); font.setBold(true);
listItem->setFont(font); listItem->setFont(font);
listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Closed")); listItem->setText(QLatin1Char('S') + QString::number(m_index) + QLatin1String(" - Closed"));
m_eventListWidget->addItem(listItem); m_eventListWidget->addItem(listItem);
} }
@ -489,7 +491,7 @@ void SessionTab::stateChanged(QNetworkSession::State state)
newState(state); newState(state);
QListWidgetItem* listItem = new QListWidgetItem(); QListWidgetItem* listItem = new QListWidgetItem();
listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+stateString(state)); listItem->setText(QLatin1Char('S') + QString::number(m_index) + QLatin1String(" - ") + stateString(state));
m_eventListWidget->addItem(listItem); m_eventListWidget->addItem(listItem);
} }
@ -500,7 +502,7 @@ void SessionTab::newState(QNetworkSession::State state)
QString configId = identifier.toString(); QString configId = identifier.toString();
QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
if (config.isValid()) { if (config.isValid()) {
iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); iapLineEdit->setText(config.name() + " (" + config.identifier() + QLatin1Char(')'));
bearerLineEdit->setText(config.bearerTypeName()); bearerLineEdit->setText(config.bearerTypeName());
} }
} else { } else {
@ -539,7 +541,7 @@ void SessionTab::error(QNetworkSession::SessionError error)
errorString = "InvalidConfigurationError"; errorString = "InvalidConfigurationError";
break; break;
} }
listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+errorString); listItem->setText(QLatin1Char('S') + QString::number(m_index) + QString(" - ") + errorString);
m_eventListWidget->addItem(listItem); m_eventListWidget->addItem(listItem);
msgBox.setText(errorString); msgBox.setText(errorString);

View File

@ -175,7 +175,7 @@ void MainWindow::setDirectory(const QString &path)
QDir dir(path); QDir dir(path);
QStringList files = dir.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot); QStringList files = dir.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot);
foreach(const QString &file, files) { foreach(const QString &file, files) {
QImageReader img(path + QLatin1String("/")+file); QImageReader img(path + QLatin1Char('/') +file);
QImage image = img.read(); QImage image = img.read();
if (!image.isNull()) { if (!image.isNull()) {
{ {

View File

@ -166,7 +166,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event)
QMimeData *mimeData = new QMimeData; QMimeData *mimeData = new QMimeData;
mimeData->setText(child->text()); mimeData->setText(child->text());
mimeData->setData("application/x-hotspot", mimeData->setData("application/x-hotspot",
QByteArray::number(hotSpot.x()) + " " + QByteArray::number(hotSpot.y())); QByteArray::number(hotSpot.x()) + ' ' + QByteArray::number(hotSpot.y()));
QPixmap pixmap(child->size()); QPixmap pixmap(child->size());
child->render(&pixmap); child->render(&pixmap);

View File

@ -139,7 +139,7 @@ private slots:
// update label, add ".0" if needed. // update label, add ".0" if needed.
QString number = QString::number(scalefactorF); QString number = QString::number(scalefactorF);
if (!number.contains(".")) if (!number.contains(QLatin1Char('.')))
number.append(".0"); number.append(".0");
m_label->setText(number); m_label->setText(number);
} }
@ -203,8 +203,8 @@ DemoController::DemoController(DemoContainerList *demos, QCommandLineParser *par
foreach (QScreen *screen, screens) { foreach (QScreen *screen, screens) {
// create scale control line // create scale control line
QSize screenSize = screen->geometry().size(); QSize screenSize = screen->geometry().size();
QString screenId = screen->name() + " " + QString::number(screenSize.width()) QString screenId = screen->name() + QLatin1Char(' ') + QString::number(screenSize.width())
+ " " + QString::number(screenSize.height()); + QLatin1Char(' ') + QString::number(screenSize.height());
LabelSlider *slider = new LabelSlider(this, screenId, layout, layoutRow++); LabelSlider *slider = new LabelSlider(this, screenId, layout, layoutRow++);
slider->setValue(getScreenFactorWithoutPixelDensity(screen) * 10); slider->setValue(getScreenFactorWithoutPixelDensity(screen) * 10);

View File

@ -602,7 +602,7 @@ int main(int argc, char **argv)
pcmd.setType(type); pcmd.setType(type);
pcmd.setCheckersBackground(checkers_background); pcmd.setCheckersBackground(checkers_background);
pcmd.setContents(content); pcmd.setContents(content);
QString file = QString(files.at(j)).replace(".", "_") + ".ps"; QString file = QString(files.at(j)).replace(QLatin1Char('.'), QLatin1Char('_')) + ".ps";
QPrinter p(highres ? QPrinter::HighResolution : QPrinter::ScreenResolution); QPrinter p(highres ? QPrinter::HighResolution : QPrinter::ScreenResolution);
if (printdlg) { if (printdlg) {

View File

@ -141,7 +141,7 @@ void MiniHttpServerConnection::handlePendingRequest()
} }
QUrl uri = QUrl::fromEncoded(request.mid(4, eol - int(strlen(http11)) - 4)); QUrl uri = QUrl::fromEncoded(request.mid(4, eol - int(strlen(http11)) - 4));
source.setFileName(":" + uri.path()); source.setFileName(QLatin1Char(':') + uri.path());
// connection-close? // connection-close?
request = request.toLower(); request = request.toLower();

View File

@ -159,7 +159,7 @@ int main(int argc, char *argv[])
headersFile=str.mid(10); headersFile=str.mid(10);
else if (str == "--serial") else if (str == "--serial")
dl.setQueueMode(DownloadManager::Serial); dl.setQueueMode(DownloadManager::Serial);
else if (str.startsWith("-")) else if (str.startsWith(QLatin1Char('-')))
qDebug() << "unsupported option" << str; qDebug() << "unsupported option" << str;
else { else {
QUrl url(QUrl::fromUserInput(str)); QUrl url(QUrl::fromUserInput(str));

View File

@ -42,9 +42,9 @@ TransferItem::TransferItem(const QNetworkRequest &r, const QString &u, const QSt
void TransferItem::progress(qint64 sent, qint64 total) void TransferItem::progress(qint64 sent, qint64 total)
{ {
if (total > 0) if (total > 0)
qDebug() << (sent*100/total) << "%"; qDebug() << (sent*100/total) << '%';
else else
qDebug() << sent << "B"; qDebug() << sent << 'B';
} }
void TransferItem::start() void TransferItem::start()

View File

@ -87,7 +87,7 @@ void PropertyField::propertyChanged()
m_lastChangeTime = QTime::currentTime().addSecs(-5); m_lastChangeTime = QTime::currentTime().addSecs(-5);
} }
qDebug() << " " << QString::fromUtf8(m_prop.name()) << ":" << val; qDebug() << " " << QString::fromUtf8(m_prop.name()) << ':' << val;
// If the value has recently changed, show the change // If the value has recently changed, show the change
if (text != m_lastText || m_lastChangeTime.elapsed() < 1000) { if (text != m_lastText || m_lastChangeTime.elapsed() < 1000) {
setText(m_lastTextShowing + " -> " + text); setText(m_lastTextShowing + " -> " + text);

View File

@ -201,7 +201,7 @@ QString TabletWidget::buttonsToString(Qt::MouseButtons bs)
if (bs.testFlag(b)) if (bs.testFlag(b))
ret << buttonToString(b); ret << buttonToString(b);
} }
return ret.join("|"); return ret.join(QLatin1Char('|'));
} }
void TabletWidget::tabletEvent(QTabletEvent *event) void TabletWidget::tabletEvent(QTabletEvent *event)

View File

@ -63,7 +63,7 @@ protected:
label->setTextInteractionFlags(Qt::TextBrowserInteraction); label->setTextInteractionFlags(Qt::TextBrowserInteraction);
label->setOpenExternalLinks(true); label->setOpenExternalLinks(true);
QString link("<a href=" + path + ">" + path + "</a>"); QString link("<a href=" + path + QLatin1Char('>') + path + "</a>");
label->setText(link); label->setText(link);
return label; return label;