diff options
163 files changed, 827 insertions, 846 deletions
diff --git a/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp b/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp index 36c170a..e9659cf 100644 --- a/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp +++ b/src/3rdparty/clucene/src/CLucene/store/FSDirectory.cpp @@ -624,7 +624,7 @@ LuceneLock* FSDirectory::makeLock(const QString& name) QString lockFile(getLockPrefix()); - lockFile.append(QLatin1String("-")).append(name); + lockFile.append(QLatin1Char('-')).append(name); return _CLNEW FSLock(lockDir, lockFile); } diff --git a/src/3rdparty/clucene/src/CLucene/util/Misc.cpp b/src/3rdparty/clucene/src/CLucene/util/Misc.cpp index 069b487..cb2efe2 100644 --- a/src/3rdparty/clucene/src/CLucene/util/Misc.cpp +++ b/src/3rdparty/clucene/src/CLucene/util/Misc.cpp @@ -181,12 +181,9 @@ void Misc::segmentname(QString& buffer, int32_t bufferLen, CND_PRECONDITION(!segment.isEmpty(), "segment is NULL"); CND_PRECONDITION(!ext.isEmpty(), "extention is NULL"); - buffer.clear(); - if (x == -1) { - buffer = QString(segment + ext); - } else { - buffer = QString(QLatin1String("%1%2%3")).arg(segment).arg(ext).arg(x); - } + buffer = segment + ext; + if (x != -1) + buffer += QString::number(x); } // #pragma mark -- TCHAR related utils diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp index 4b94a94..26323e8 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_instance.cpp @@ -337,7 +337,7 @@ JSValuePtr QtField::valueFromInstance(ExecState* exec, const Instance* inst) con return ret; } else { - QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name())); + QString msg = QString::fromLatin1("cannot access member `%1' of deleted QObject").arg(QLatin1String(name())); return throwError(exec, GeneralError, msg.toLatin1().constData()); } } @@ -362,7 +362,7 @@ void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValueP } else if (m_type == DynamicProperty) obj->setProperty(m_dynamicProperty.constData(), val); } else { - QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name())); + QString msg = QString::fromLatin1("cannot access member `%1' of deleted QObject").arg(QLatin1String(name())); throwError(exec, GeneralError, msg.toLatin1().constData()); } } diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp index c7ba6c2..5a73dc7 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp @@ -1515,7 +1515,7 @@ JSValuePtr QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionOb bool ok = QMetaObject::connect(sender, signalIndex, conn, conn->metaObject()->methodOffset()); if (!ok) { delete conn; - QString msg = QString(QLatin1String("QtMetaMethod.connect: failed to connect to %1::%2()")) + QString msg = QString::fromLatin1("QtMetaMethod.connect: failed to connect to %1::%2()") .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); return throwError(exec, GeneralError, msg.toLatin1().constData()); @@ -1541,14 +1541,14 @@ JSValuePtr QtRuntimeConnectionMethod::call(ExecState* exec, JSObject* functionOb } if (!ret) { - QString msg = QString(QLatin1String("QtMetaMethod.disconnect: failed to disconnect from %1::%2()")) + QString msg = QString::fromLatin1("QtMetaMethod.disconnect: failed to disconnect from %1::%2()") .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); return throwError(exec, GeneralError, msg.toLatin1().constData()); } } } else { - QString msg = QString(QLatin1String("QtMetaMethod.%1: %2::%3() is not a signal")) + QString msg = QString::fromLatin1("QtMetaMethod.%1: %2::%3() is not a signal") .arg(QLatin1String(d->m_isConnect ? "connect": "disconnect")) .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp index 2050a70..39ccefe 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp @@ -357,7 +357,7 @@ HashMap<String, String> parseAttributes(const String& string, bool& attrsOK) state.gotAttributes = false; QXmlStreamReader stream; - QString dummy = QString(QLatin1String("<?xml version=\"1.0\"?><attrs %1 />")).arg(string); + QString dummy = QString::fromLatin1("<?xml version=\"1.0\"?><attrs %1 />").arg(string); stream.addData(dummy); while (!stream.atEnd()) { stream.readNext(); diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp index e68be2b..bff9edb 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/PathQt.cpp @@ -286,10 +286,10 @@ String Path::debugString() const switch (cur.type) { case QPainterPath::MoveToElement: - ret += QString(QLatin1String("M %1 %2")).arg(cur.x).arg(cur.y); + ret += QString::fromLatin1("M %1 %2").arg(cur.x).arg(cur.y); break; case QPainterPath::LineToElement: - ret += QString(QLatin1String("L %1 %2")).arg(cur.x).arg(cur.y); + ret += QString::fromLatin1("L %1 %2").arg(cur.x).arg(cur.y); break; case QPainterPath::CurveToElement: { @@ -299,7 +299,7 @@ String Path::debugString() const Q_ASSERT(c1.type == QPainterPath::CurveToDataElement); Q_ASSERT(c2.type == QPainterPath::CurveToDataElement); - ret += QString(QLatin1String("C %1 %2 %3 %4 %5 %6")).arg(cur.x).arg(cur.y).arg(c1.x).arg(c1.y).arg(c2.x).arg(c2.y); + ret += QString::fromLatin1("C %1 %2 %3 %4 %5 %6").arg(cur.x).arg(cur.y).arg(c1.x).arg(c1.y).arg(c2.x).arg(c2.y); i += 2; break; diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp index 44c3e9e..e1ffb81 100644 --- a/src/activeqt/container/qaxbase.cpp +++ b/src/activeqt/container/qaxbase.cpp @@ -421,7 +421,7 @@ public: argv[p + 1] = varp + p + 1; } else { argv[p + 1] = const_cast<void*>(varp[p + 1].constData()); - if (ptype.endsWith("*")) { + if (ptype.endsWith('*')) { argv_pointer[p + 1] = argv[p + 1]; argv[p + 1] = argv_pointer + p + 1; } @@ -648,7 +648,7 @@ QByteArray QAxEventSink::findProperty(DISPID dispID) int index = mo->indexOfProperty(propname); const QMetaProperty prop = mo->property(index); propsignal += prop.typeName(); - propsignal += ")"; + propsignal += ')'; addProperty(dispID, propname, propsignal); return propname; @@ -1661,7 +1661,7 @@ private: void addProperty(const QByteArray &type, const QByteArray &name, uint flags) { QByteArray propertyType(type); - if (propertyType.endsWith("&")) + if (propertyType.endsWith('&')) propertyType.chop(1); Property &prop = property_list[name]; @@ -2046,11 +2046,11 @@ QByteArray MetaObjectGenerator::guessTypes(const TYPEDESC &tdesc, ITypeInfo *inf case VT_INT: case VT_UINT: case VT_CY: - str += "&"; + str += '&'; break; case VT_PTR: if (str == "QFont" || str == "QPixmap") { - str += "&"; + str += '&'; break; } else if (str == "void*") { str = "void **"; @@ -2059,19 +2059,19 @@ QByteArray MetaObjectGenerator::guessTypes(const TYPEDESC &tdesc, ITypeInfo *inf // FALLTHROUGH default: if (str == "QColor") - str += "&"; + str += '&'; else if (str == "QDateTime") - str += "&"; + str += '&'; else if (str == "QVariantList") - str += "&"; + str += '&'; else if (str == "QByteArray") - str += "&"; + str += '&'; else if (str == "QStringList") - str += "&"; + str += '&'; else if (!str.isEmpty() && hasEnum(str)) - str += "&"; + str += '&'; else if (!str.isEmpty() && str != "QFont" && str != "QPixmap" && str != "QVariant") - str += "*"; + str += '*'; } break; case VT_SAFEARRAY: @@ -2089,7 +2089,7 @@ QByteArray MetaObjectGenerator::guessTypes(const TYPEDESC &tdesc, ITypeInfo *inf default: str = guessTypes(tdesc.lpadesc->tdescElem, info, function); if (!str.isEmpty()) - str = "QList<" + str + ">"; + str = "QList<" + str + '>'; break; } break; @@ -2097,7 +2097,7 @@ QByteArray MetaObjectGenerator::guessTypes(const TYPEDESC &tdesc, ITypeInfo *inf str = guessTypes(tdesc.lpadesc->tdescElem, info, function); if (!str.isEmpty()) { for (int index = 0; index < tdesc.lpadesc->cDims; ++index) - str += "[" + QByteArray::number((int)tdesc.lpadesc->rgbounds[index].cElements) + "]"; + str += '[' + QByteArray::number((int)tdesc.lpadesc->rgbounds[index].cElements) + ']'; } break; case VT_USERDEFINED: @@ -2114,7 +2114,7 @@ QByteArray MetaObjectGenerator::guessTypes(const TYPEDESC &tdesc, ITypeInfo *inf } if (tdesc.vt & VT_BYREF) - str += "&"; + str += '&'; str.replace("&*", "**"); return str; @@ -2141,7 +2141,7 @@ void MetaObjectGenerator::readClassInfo() if (d->useClassInfo && !hasClassInfo("CoClass")) { QString coClassIDstr = iidnames.value(QLatin1String("/CLSID/") + coClassID + QLatin1String("/Default"), coClassID).toString(); addClassInfo("CoClass", coClassIDstr.isEmpty() ? coClassID.toLatin1() : coClassIDstr.toLatin1()); - QByteArray version = QByteArray::number(typeattr->wMajorVerNum) + "." + QByteArray::number(typeattr->wMinorVerNum); + QByteArray version = QByteArray::number(typeattr->wMajorVerNum) + '.' + QByteArray::number(typeattr->wMinorVerNum); if (version != "0.0") addClassInfo("Version", version); } @@ -2174,7 +2174,7 @@ void MetaObjectGenerator::readClassInfo() while (tlfile.isEmpty() && vit != versions.end()) { QString version = *vit; ++vit; - tlfile = controls.value(QLatin1String("/") + version + QLatin1String("/0/win32/.")).toString(); + tlfile = controls.value(QLatin1Char('/') + version + QLatin1String("/0/win32/.")).toString(); } controls.endGroup(); } else { @@ -2347,7 +2347,7 @@ void MetaObjectGenerator::addChangedSignal(const QByteArray &function, const QBy // generate changed signal QByteArray signalName(function); signalName += "Changed"; - QByteArray signalProto = signalName + "(" + replaceType(type) + ")"; + QByteArray signalProto = signalName + '(' + replaceType(type) + ')'; if (!hasSignal(signalProto)) addSignal(signalProto, function); if (eventSink) @@ -2364,7 +2364,7 @@ void MetaObjectGenerator::addSetterSlot(const QByteArray &property) set = "set"; prototype[0] = toupper(prototype[0]); } - prototype = set + prototype + "(" + propertyType(property) + ")"; + prototype = set + prototype + '(' + propertyType(property) + ')'; if (!hasSlot(prototype)) addSlot(0, prototype, property); } @@ -2381,7 +2381,7 @@ QByteArray MetaObjectGenerator::createPrototype(FUNCDESC *funcdesc, ITypeInfo *t type = guessTypes(funcdesc->lprgelemdescParam->tdesc, typeinfo, function); } - prototype = function + "("; + prototype = function + '('; if (funcdesc->invkind == INVOKE_FUNC && type == hresult) type = 0; @@ -2395,7 +2395,7 @@ QByteArray MetaObjectGenerator::createPrototype(FUNCDESC *funcdesc, ITypeInfo *t QByteArray ptype = guessTypes(tdesc, typeinfo, function); if (pdesc.wParamFlags & PARAMFLAG_FRETVAL) { - if (ptype.endsWith("&")) { + if (ptype.endsWith('&')) { ptype.truncate(ptype.length() - 1); } else if (ptype.endsWith("**")) { ptype.truncate(ptype.length() - 1); @@ -2403,8 +2403,8 @@ QByteArray MetaObjectGenerator::createPrototype(FUNCDESC *funcdesc, ITypeInfo *t type = ptype; } else { prototype += ptype; - if (pdesc.wParamFlags & PARAMFLAG_FOUT && !ptype.endsWith("&") && !ptype.endsWith("**")) - prototype += "&"; + if (pdesc.wParamFlags & PARAMFLAG_FOUT && !ptype.endsWith('&') && !ptype.endsWith("**")) + prototype += '&'; if (optional || pdesc.wParamFlags & PARAMFLAG_FOPT) paramName += "=0"; else if (pdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) { @@ -2414,22 +2414,22 @@ QByteArray MetaObjectGenerator::createPrototype(FUNCDESC *funcdesc, ITypeInfo *t parameters << paramName; } if (p < funcdesc->cParams && !(pdesc.wParamFlags & PARAMFLAG_FRETVAL)) - prototype += ","; + prototype += ','; } if (!prototype.isEmpty()) { - if (prototype.right(1) == ",") { + if (prototype.endsWith(',')) { if (funcdesc->invkind == INVOKE_PROPERTYPUT && p == funcdesc->cParams) { TYPEDESC tdesc = funcdesc->lprgelemdescParam[p-1].tdesc; QByteArray ptype = guessTypes(tdesc, typeinfo, function); prototype += ptype; - prototype += ")"; + prototype += ')'; parameters << "rhs"; } else { prototype[prototype.length()-1] = ')'; } } else { - prototype += ")"; + prototype += ')'; } } @@ -2577,11 +2577,11 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs) if (defargs) { parameters.takeLast(); - int lastParam = prototype.lastIndexOf(","); + int lastParam = prototype.lastIndexOf(','); if (lastParam == -1) - lastParam = prototype.indexOf("(") + 1; + lastParam = prototype.indexOf('(') + 1; prototype.truncate(lastParam); - prototype += ")"; + prototype += ')'; } } while (defargs); } @@ -2597,8 +2597,8 @@ void MetaObjectGenerator::readFuncsInfo(ITypeInfo *typeinfo, ushort nFuncs) QString strDocu = QString::fromUtf16((const ushort*)bstrDocu); SysFreeString(bstrDocu); if (!!strDocu) - desc += "[" + strDocu + "]"; - desc += "\n"; + desc += '[' + strDocu + ']'; + desc += '\n'; #endif typeinfo->ReleaseFuncDesc(funcdesc); } @@ -2680,8 +2680,8 @@ void MetaObjectGenerator::readVarsInfo(ITypeInfo *typeinfo, ushort nVars) QString strDocu = QString::fromUtf16((const ushort*)bstrDocu); SysFreeString(bstrDocu); if (!!strDocu) - desc += "[" + strDocu + "]"; - desc += "\n"; + desc += '[' + strDocu + ']'; + desc += '\n'; #endif typeinfo->ReleaseVarDesc(vardesc); } @@ -2827,8 +2827,8 @@ void MetaObjectGenerator::readEventInterface(ITypeInfo *eventinfo, IConnectionPo QString strDocu = QString::fromUtf16((const ushort*)bstrDocu); SysFreeString(bstrDocu); if (!!strDocu) - desc += "[" + strDocu + "]"; - desc += "\n"; + desc += '[' + strDocu + ']'; + desc += '\n'; #endif eventinfo->ReleaseFuncDesc(funcdesc); } @@ -4398,8 +4398,8 @@ QVariant QAxBase::asVariant() const cn = cn.mid(cn.lastIndexOf(':') + 1); QObject *object = qObject(); if (QMetaType::type(cn)) - qvar = QVariant(qRegisterMetaType<QObject*>(cn + "*"), &object); -// qVariantSetValue(qvar, qObject(), cn + "*"); + qvar = QVariant(qRegisterMetaType<QObject*>(cn + '*'), &object); +// qVariantSetValue(qvar, qObject(), cn + '*'); } return qvar; diff --git a/src/activeqt/container/qaxdump.cpp b/src/activeqt/container/qaxdump.cpp index 62ef0a4..c3218a9 100644 --- a/src/activeqt/container/qaxdump.cpp +++ b/src/activeqt/container/qaxdump.cpp @@ -94,14 +94,14 @@ static QByteArray namedPrototype(const QList<QByteArray> ¶meterTypes, const prototype += type; if (p < parameterNames.count()) - prototype += " " + parameterNames.at(p); + prototype += ' ' + parameterNames.at(p); if (numDefArgs >= parameterTypes.count() - p) prototype += " = 0"; if (p < parameterTypes.count() - 1) prototype += ", "; } - prototype += ")"; + prototype += ')'; return prototype; } @@ -196,8 +196,8 @@ QString qax_generateDocumentation(QAxBase *that) prototype = namedPrototype(slot.parameterTypes(), slot.parameterNames()); QString detail = QString::fromLatin1("<h3><a name=") + QString::fromLatin1(name.constData()) + QLatin1String("></a>") + - QString::fromLatin1(returntype.constData()) + QLatin1String(" ") + - QString::fromLatin1(name.constData()) + QLatin1String(" ") + + QLatin1String(returntype.constData()) + QLatin1Char(' ') + + QLatin1String(name.constData()) + QLatin1Char(' ') + QString::fromLatin1(prototype.constData()) + QLatin1String("<tt> [slot]</tt></h3>\n"); prototype = namedPrototype(slot.parameterTypes(), QList<QByteArray>()); detail += docuFromName(typeInfo, QString::fromLatin1(name.constData())); @@ -220,14 +220,14 @@ QString qax_generateDocumentation(QAxBase *that) returntype = "QAxObject *"; } if (returntype != "void") - detail += QString::fromLatin1(returntype.constData()) + QLatin1String(" result = "); - detail += QLatin1String("object->") + QString::fromLatin1(functionToCall.constData()) + - QLatin1String("(\"" + name + prototype + "\""); + detail += QLatin1String(returntype.constData()) + QLatin1String(" result = "); + detail += QLatin1String("object->") + QLatin1String(functionToCall.constData()) + + QLatin1String("(\"" + name + prototype + '\"'); if (hasParams) detail += QLatin1String(", params"); - detail += QLatin1String(")"); + detail += QLatin1Char(')'); if (returntype != "void" && returntype != "QAxObject *" && returntype != "QVariant") - detail += QLatin1String(".") + QString::fromLatin1(toType(returntype)); + detail += QLatin1Char('.') + QLatin1String(toType(returntype)); detail += QLatin1String(";</pre>\n"); } else { detail += QLatin1String("<p>This function has parameters of unsupported types and cannot be called directly."); @@ -262,9 +262,9 @@ QString qax_generateDocumentation(QAxBase *that) QByteArray name = signature.left(signature.indexOf('(')); stream << "<li>void <a href=\"#" << name << "\"><b>" << name << "</b></a>" << prototype << ";</li>" << endl; - QString detail = QLatin1String("<h3><a name=") + QString::fromLatin1(name.constData()) + QLatin1String("></a>void ") + - QString::fromLatin1(name.constData()) + QLatin1String(" ") + - QString::fromLatin1(prototype.constData()) + QLatin1String("<tt> [signal]</tt></h3>\n"); + QString detail = QLatin1String("<h3><a name=") + QLatin1String(name.constData()) + QLatin1String("></a>void ") + + QLatin1String(name.constData()) + QLatin1Char(' ') + + QLatin1String(prototype.constData()) + QLatin1String("<tt> [signal]</tt></h3>\n"); if (typeLib) { interCount = 0; do { @@ -311,8 +311,8 @@ QString qax_generateDocumentation(QAxBase *that) stream << "<li>" << type << " <a href=\"#" << name << "\"><b>" << name << "</b></a>;</li>" << endl; QString detail = QLatin1String("<h3><a name=") + QString::fromLatin1(name.constData()) + QLatin1String("></a>") + - QString::fromLatin1(type.constData()) + - QLatin1String(" ") + QString::fromLatin1(name.constData()) + QLatin1String("</h3>\n"); + QLatin1String(type.constData()) + + QLatin1Char(' ') + QLatin1String(name.constData()) + QLatin1String("</h3>\n"); detail += docuFromName(typeInfo, QString::fromLatin1(name)); QVariant::Type vartype = QVariant::nameToType(type); if (!prop.isReadable()) @@ -326,14 +326,14 @@ QString qax_generateDocumentation(QAxBase *that) if (prop.isEnumType()) detail += QLatin1String("\tint val = "); else - detail += QLatin1String("\t") + QString::fromLatin1(type.constData()) + QLatin1String(" val = "); - detail += QLatin1String("object->property(\"") + QString::fromLatin1(name.constData()) + - QLatin1String("\").") + QString::fromLatin1(toType(type).constData()) + QLatin1String(";\n"); + detail += QLatin1Char('\t') + QLatin1String(type.constData()) + QLatin1String(" val = "); + detail += QLatin1String("object->property(\"") + QLatin1String(name.constData()) + + QLatin1String("\").") + QLatin1String(toType(type).constData()) + QLatin1String(";\n"); detail += QLatin1String("</pre>\n"); } else if (type == "IDispatch*" || type == "IUnknown*") { detail += QLatin1String("<p>Get the subobject using querySubObject:<pre>\n"); - detail += QLatin1String("\tQAxObject *") + QString::fromLatin1(name.constData()) + - QLatin1String(" = object->querySubObject(\"") + QString::fromLatin1(name.constData()) + QLatin1String("\");\n"); + detail += QLatin1String("\tQAxObject *") + QLatin1String(name.constData()) + + QLatin1String(" = object->querySubObject(\"") + QLatin1String(name.constData()) + QLatin1String("\");\n"); detail += QLatin1String("</pre>\n"); } else { detail += QLatin1String("<p>This property is of an unsupported type.\n"); diff --git a/src/activeqt/container/qaxscript.cpp b/src/activeqt/container/qaxscript.cpp index c69fea0..8f8186a 100644 --- a/src/activeqt/container/qaxscript.cpp +++ b/src/activeqt/container/qaxscript.cpp @@ -1203,9 +1203,9 @@ QString QAxScriptManager::scriptFileFilter() continue; allFiles += QLatin1String(" *") + engine.extension; - specialFiles += QLatin1String(";;") + engine.name + QLatin1String(" Files (*") + engine.extension + QLatin1String(")"); + specialFiles += QLatin1String(";;") + engine.name + QLatin1String(" Files (*") + engine.extension + QLatin1Char(')'); } - allFiles += QLatin1String(")"); + allFiles += QLatin1Char(')'); return allFiles + specialFiles + QLatin1String(";;All Files (*.*)"); } diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index d919382..1771293 100644 --- a/src/activeqt/control/qaxserver.cpp +++ b/src/activeqt/control/qaxserver.cpp @@ -90,7 +90,7 @@ QAxFactory *qAxFactory() QStringList keys(qax_factory->featureList()); for (int i = 0; i < keys.count(); ++i) { QString key(keys.at(i)); - qRegisterMetaType((key + QLatin1String("*")).toLatin1(), (void**)0); + qRegisterMetaType((key + QLatin1Char('*')).toLatin1(), (void**)0); } } return qax_factory; @@ -208,9 +208,9 @@ HRESULT UpdateRegistry(BOOL bRegister) { qAxIsServer = false; QString file = QString::fromLocal8Bit(qAxModuleFilename); - QString path = file.left(file.lastIndexOf(QLatin1String("\\"))+1); + QString path = file.left(file.lastIndexOf(QLatin1Char('\\'))+1); QString module = file.right(file.length() - path.length()); - module = module.left(module.lastIndexOf(QLatin1String("."))); + module = module.left(module.lastIndexOf(QLatin1Char('.'))); const QString appId = qAxFactory()->appID().toString().toUpper(); const QString libId = qAxFactory()->typeLibID().toString().toUpper(); @@ -226,7 +226,7 @@ HRESULT UpdateRegistry(BOOL bRegister) DWORD major = libAttr->wMajorVerNum; DWORD minor = libAttr->wMinorVerNum; - typeLibVersion = QString::number((uint)major) + QLatin1String(".") + QString::number((uint)minor); + typeLibVersion = QString::number((uint)major) + QLatin1Char('.') + QString::number((uint)minor); if (bRegister) RegisterTypeLib(qAxTypeLibrary, (TCHAR*)libFile.utf16(), 0); @@ -271,12 +271,12 @@ HRESULT UpdateRegistry(BOOL bRegister) className = qax_clean_type(className, mo); if (object) { // don't register subobject classes - QString classVersion = mo ? QString(QLatin1String(mo->classInfo(mo->indexOfClassInfo("Version")).value())) : QString(); + QString classVersion = mo ? QString::fromLatin1(mo->classInfo(mo->indexOfClassInfo("Version")).value()) : QString(); if (classVersion.isNull()) classVersion = QLatin1String("1.0"); bool insertable = mo && !qstricmp(mo->classInfo(mo->indexOfClassInfo("Insertable")).value(), "yes"); bool control = object->isWidgetType(); - const QString classMajorVersion = classVersion.left(classVersion.indexOf(QLatin1String("."))); + const QString classMajorVersion = classVersion.left(classVersion.indexOf(QLatin1Char('.'))); uint olemisc = OLEMISC_SETCLIENTSITEFIRST |OLEMISC_ACTIVATEWHENVISIBLE |OLEMISC_INSIDEOUT @@ -287,17 +287,17 @@ HRESULT UpdateRegistry(BOOL bRegister) else if (qFindChild<QMenuBar*>(object) && !qax_disable_inplaceframe) olemisc |= OLEMISC_WANTSTOMENUMERGE; - settings.setValue(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String(".") + classMajorVersion + QLatin1String("/."), className + QLatin1String(" Class")); - settings.setValue(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String(".") + classMajorVersion + QLatin1String("/CLSID/."), classId); + settings.setValue(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1Char('.') + classMajorVersion + QLatin1String("/."), className + QLatin1String(" Class")); + settings.setValue(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1Char('.') + classMajorVersion + QLatin1String("/CLSID/."), classId); if (insertable) - settings.setValue(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String(".") + classMajorVersion + QLatin1String("/Insertable/."), QVariant(QLatin1String(""))); + settings.setValue(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1Char('.') + classMajorVersion + QLatin1String("/Insertable/."), QVariant(QLatin1String(""))); - settings.setValue(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String("/."), className + QLatin1String(" Class")); - settings.setValue(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String("/CLSID/."), classId); - settings.setValue(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String("/CurVer/."), module + QLatin1String(".") + className + QLatin1String(".") + classMajorVersion); + settings.setValue(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1String("/."), className + QLatin1String(" Class")); + settings.setValue(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1String("/CLSID/."), classId); + settings.setValue(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1String("/CurVer/."), module + QLatin1Char('.') + className + QLatin1Char('.') + classMajorVersion); settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/."), className + QLatin1String(" Class")); - if (file.right(3).toLower() == QLatin1String("exe")) + if (file.endsWith(QLatin1String("exe"), Qt::CaseInsensitive)) settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/AppID"), appId); if (control) settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/Control/."), QVariant(QLatin1String(""))); @@ -307,15 +307,15 @@ HRESULT UpdateRegistry(BOOL bRegister) settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/InProcServer32/."), file); else settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/LocalServer32/."), - QLatin1String("\"") + file + QLatin1String("\" -activex")); + QLatin1Char('\"') + file + QLatin1String("\" -activex")); settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/MiscStatus/."), control ? QLatin1String("1") : QLatin1String("0")); settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/MiscStatus/1/."), QString::number(olemisc)); settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/Programmable/."), QVariant(QLatin1String(""))); - settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/ToolboxBitmap32/."), QLatin1String("\"") + + settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/ToolboxBitmap32/."), QLatin1Char('\"') + file + QLatin1String("\", 101")); settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/TypeLib/."), libId); settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/Version/."), classVersion); - settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/VersionIndependentProgID/."), module + QLatin1String(".") + className); - settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/ProgID/."), module + QLatin1String(".") + className + QLatin1String(".") + classVersion.left(classVersion.indexOf(QLatin1Char('.')))); + settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/VersionIndependentProgID/."), module + QLatin1Char('.') + className); + settings.setValue(QLatin1String("/CLSID/") + classId + QLatin1String("/ProgID/."), module + QLatin1Char('.') + className + QLatin1Char('.') + classVersion.left(classVersion.indexOf(QLatin1Char('.')))); QString mime = QLatin1String(mo->classInfo(mo->indexOfClassInfo("MIME")).value()); if (!mime.isEmpty()) { @@ -330,15 +330,15 @@ HRESULT UpdateRegistry(BOOL bRegister) mime = mime.left(mime.length() - extension.length() - 1); // Prepend '.' before extension, if required. extension = extension.trimmed(); - if (extension[0] != QChar(QLatin1Char('.'))) - extension = QLatin1String(".") + extension; + if (extension[0] != QLatin1Char('.')) + extension = QLatin1Char('.') + extension; } if (!extension.isEmpty()) { - settings.setValue(QLatin1String("/") + extension + QLatin1String("/."), module + QLatin1String(".") + className); - settings.setValue(QLatin1String("/") + extension + QLatin1String("/Content Type"), mime); + settings.setValue(QLatin1Char('/') + extension + QLatin1String("/."), module + QLatin1Char('.') + className); + settings.setValue(QLatin1Char('/') + extension + QLatin1String("/Content Type"), mime); - mime = mime.replace(QLatin1String("/"), QLatin1String("\\")); + mime = mime.replace(QLatin1Char('/'), QLatin1Char('\\')); settings.setValue(QLatin1String("/MIME/Database/Content Type/") + mime + QLatin1String("/CLSID"), classId); settings.setValue(QLatin1String("/MIME/Database/Content Type/") + mime + QLatin1String("/Extension"), extension); } @@ -358,22 +358,22 @@ HRESULT UpdateRegistry(BOOL bRegister) const QString classId = qAxFactory()->classID(className).toString().toUpper(); className = qax_clean_type(className, mo); - QString classVersion = mo ? QString(QLatin1String(mo->classInfo(mo->indexOfClassInfo("Version")).value())) : QString(); + QString classVersion = mo ? QString::fromLatin1(mo->classInfo(mo->indexOfClassInfo("Version")).value()) : QString(); if (classVersion.isNull()) classVersion = QLatin1String("1.0"); - const QString classMajorVersion = classVersion.left(classVersion.indexOf(QLatin1String("."))); + const QString classMajorVersion = classVersion.left(classVersion.indexOf(QLatin1Char('.'))); qAxFactory()->unregisterClass(*key, &settings); - settings.remove(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String(".") + classMajorVersion + QLatin1String("/CLSID/.")); - settings.remove(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String(".") + classMajorVersion + QLatin1String("/Insertable/.")); - settings.remove(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String(".") + classMajorVersion + QLatin1String("/.")); - settings.remove(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String(".") + classMajorVersion); + settings.remove(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1Char('.') + classMajorVersion + QLatin1String("/CLSID/.")); + settings.remove(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1Char('.') + classMajorVersion + QLatin1String("/Insertable/.")); + settings.remove(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1Char('.') + classMajorVersion + QLatin1String("/.")); + settings.remove(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1Char('.') + classMajorVersion); - settings.remove(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String("/CLSID/.")); - settings.remove(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String("/CurVer/.")); - settings.remove(QLatin1String("/") + module + QLatin1String(".") + className + QLatin1String("/.")); - settings.remove(QLatin1String("/") + module + QLatin1String(".") + className); + settings.remove(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1String("/CLSID/.")); + settings.remove(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1String("/CurVer/.")); + settings.remove(QLatin1Char('/') + module + QLatin1Char('.') + className + QLatin1String("/.")); + settings.remove(QLatin1Char('/') + module + QLatin1Char('.') + className); settings.remove(QLatin1String("/CLSID/") + classId + QLatin1String("/AppID")); settings.remove(QLatin1String("/CLSID/") + classId + QLatin1String("/Control/.")); @@ -404,14 +404,14 @@ HRESULT UpdateRegistry(BOOL bRegister) mime = mime.left(mime.length() - extension.length() - 1); // Prepend '.' before extension, if required. extension = extension.trimmed(); - if (extension[0] != QChar(QLatin1Char('.'))) - extension = QLatin1String(".") + extension; + if (extension[0] != QLatin1Char('.')) + extension.prepend(QLatin1Char('.')); } if (!extension.isEmpty()) { - settings.remove(QLatin1String("/") + extension + QLatin1String("/Content Type")); - settings.remove(QLatin1String("/") + extension + QLatin1String("/.")); - settings.remove(QLatin1String("/") + extension); - mime = mime.replace(QLatin1String("/"), QLatin1String("\\")); + settings.remove(QLatin1Char('/') + extension + QLatin1String("/Content Type")); + settings.remove(QLatin1Char('/') + extension + QLatin1String("/.")); + settings.remove(QLatin1Char('/') + extension); + mime.replace(QLatin1Char('/'), QLatin1Char('\\')); settings.remove(QLatin1String("/MIME/Database/Content Type/") + mime + QLatin1String("/Extension")); settings.remove(QLatin1String("/MIME/Database/Content Type/") + mime + QLatin1String("/CLSID")); settings.remove(QLatin1String("/MIME/Database/Content Type/") + mime + QLatin1String("/.")); @@ -455,8 +455,8 @@ static const char* const type_map[][2] = { "QFont", "IFontDisp*" }, { "QPixmap", "IPictureDisp*" }, { "QVariant", "VARIANT" }, - { "QVariantList", "SAFEARRAY(VARIANT)" }, - { "QList<QVariant>","SAFEARRAY(VARIANT)" }, + { "QVariantList", "SAFEARRAY(VARIANT)" }, + { "QList<QVariant>", "SAFEARRAY(VARIANT)" }, { "quint64", "CY" }, { "qint64", "CY" }, { "qulonglong", "CY" }, @@ -464,8 +464,8 @@ static const char* const type_map[][2] = { "QByteArray", "SAFEARRAY(BYTE)" }, { "QStringList", "SAFEARRAY(BSTR)" }, // Userdefined Qt datatypes - some not on Borland though - { "QCursor", "enum MousePointer" }, - { "Qt::FocusPolicy","enum FocusPolicy" }, + { "QCursor", "enum MousePointer" }, + { "Qt::FocusPolicy", "enum FocusPolicy" }, #ifndef Q_CC_BOR # if __REQUIRED_RPCNDR_H_VERSION__ >= Q_REQUIRED_RPCNDR_H_VERSION { "QRect", "struct QRect" }, @@ -578,7 +578,7 @@ static QByteArray renameOverloads(const QByteArray &name) int n = mapping.value(name); if (mapping.contains(name)) { int n = mapping.value(name); - newName = name + "_" + QByteArray::number(n); + newName = name + '_' + QByteArray::number(n); mapping.insert(name, n+1); } else { mapping.insert(name, 1); @@ -686,13 +686,13 @@ static QByteArray prototype(const QList<QByteArray> ¶meterTypes, const QList QByteArray type(parameterTypes.at(p)); QByteArray name(parameterNames.at(p)); - if (type.endsWith("&")) { + if (type.endsWith('&')) { out = true; type.truncate(type.length() - 1); } else if (type.endsWith("**")) { out = true; type.truncate(type.length() - 1); - } else if (type.endsWith("*") && !subtypes.contains(type)) { + } else if (type.endsWith('*') && !subtypes.contains(type)) { type.truncate(type.length() - 1); } if (type.isEmpty()) { @@ -701,14 +701,14 @@ static QByteArray prototype(const QList<QByteArray> ¶meterTypes, const QList } type = convertTypes(type, ok); if (!out) - prototype += "[in] " + type + " "; + prototype += "[in] " + type + ' '; else - prototype += "[in,out] " + type + " "; + prototype += "[in,out] " + type + ' '; if (out) - prototype += "*"; + prototype += '*'; if (name.isEmpty()) - prototype += "p" + QByteArray::number(p); + prototype += 'p' + QByteArray::number(p); else prototype += "p_" + replaceKeyword(name); @@ -728,12 +728,12 @@ static QByteArray addDefaultArguments(const QByteArray &prototype, int numDefArg QByteArray ptype(prototype); int in = -1; while (numDefArgs) { - in = ptype.lastIndexOf("]", in); + in = ptype.lastIndexOf(']', in); ptype.replace(in, 1, ",optional]"); in = ptype.indexOf(' ', in) + 1; QByteArray type = ptype.mid(in, ptype.indexOf(' ', in) - in); if (type == "enum") - type += " " + ptype.mid(in + 5, ptype.indexOf(' ', in + 5) - in - 5); + type += ' ' + ptype.mid(in + 5, ptype.indexOf(' ', in + 5) - in - 5); ptype.replace(in, type.length(), QByteArray("VARIANT /*was: ") + type + "*/"); --numDefArgs; } @@ -801,7 +801,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN for (int j = 0; j < enumerator.keyCount(); ++j) { QByteArray key(enumerator.key(j)); while (enumValues.contains(key)) { - key += "_"; + key += '_'; } enumValues.append(key); uint value = (uint)enumerator.value(j); @@ -822,32 +822,32 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN if (!enums.contains("MousePointer")) { enums.append("MousePointer"); out << "\tenum MousePointer {" << endl; - out << "\t\tArrowCursor = " << Qt::ArrowCursor << "," << endl; - out << "\t\tUpArrowCursor = " << Qt::UpArrowCursor << "," << endl; - out << "\t\tCrossCursor = " << Qt::CrossCursor << "," << endl; - out << "\t\tWaitCursor = " << Qt::WaitCursor << "," << endl; - out << "\t\tIBeamCursor = " << Qt::IBeamCursor << "," << endl; - out << "\t\tSizeVerCursor = " << Qt::SizeVerCursor << "," << endl; - out << "\t\tSizeHorCursor = " << Qt::SizeHorCursor << "," << endl; - out << "\t\tSizeBDiagCursor = " << Qt::SizeBDiagCursor << "," << endl; - out << "\t\tSizeFDiagCursor = " << Qt::SizeFDiagCursor << "," << endl; - out << "\t\tSizeAllCursor = " << Qt::SizeAllCursor << "," << endl; - out << "\t\tBlankCursor = " << Qt::BlankCursor << "," << endl; - out << "\t\tSplitVCursor = " << Qt::SplitVCursor << "," << endl; - out << "\t\tSplitHCursor = " << Qt::SplitHCursor << "," << endl; - out << "\t\tPointingHandCursor = " << Qt::PointingHandCursor << "," << endl; - out << "\t\tForbiddenCursor = " << Qt::ForbiddenCursor << "," << endl; - out << "\t\tWhatsThisCursor = " << Qt::WhatsThisCursor << "," << endl; + out << "\t\tArrowCursor = " << Qt::ArrowCursor << ',' << endl; + out << "\t\tUpArrowCursor = " << Qt::UpArrowCursor << ',' << endl; + out << "\t\tCrossCursor = " << Qt::CrossCursor << ',' << endl; + out << "\t\tWaitCursor = " << Qt::WaitCursor << ',' << endl; + out << "\t\tIBeamCursor = " << Qt::IBeamCursor << ',' << endl; + out << "\t\tSizeVerCursor = " << Qt::SizeVerCursor << ',' << endl; + out << "\t\tSizeHorCursor = " << Qt::SizeHorCursor << ',' << endl; + out << "\t\tSizeBDiagCursor = " << Qt::SizeBDiagCursor << ',' << endl; + out << "\t\tSizeFDiagCursor = " << Qt::SizeFDiagCursor << ',' << endl; + out << "\t\tSizeAllCursor = " << Qt::SizeAllCursor << ',' << endl; + out << "\t\tBlankCursor = " << Qt::BlankCursor << ',' << endl; + out << "\t\tSplitVCursor = " << Qt::SplitVCursor << ',' << endl; + out << "\t\tSplitHCursor = " << Qt::SplitHCursor << ',' << endl; + out << "\t\tPointingHandCursor = " << Qt::PointingHandCursor << ',' << endl; + out << "\t\tForbiddenCursor = " << Qt::ForbiddenCursor << ',' << endl; + out << "\t\tWhatsThisCursor = " << Qt::WhatsThisCursor << ',' << endl; out << "\t\tBusyCursor\t= " << Qt::BusyCursor << endl; out << "\t};" << endl << endl; } if (!enums.contains("FocusPolicy")) { enums.append("FocusPolicy"); out << "\tenum FocusPolicy {" << endl; - out << "\t\tNoFocus = " << Qt::NoFocus << "," << endl; - out << "\t\tTabFocus = " << Qt::TabFocus << "," << endl; - out << "\t\tClickFocus = " << Qt::ClickFocus << "," << endl; - out << "\t\tStrongFocus = " << Qt::StrongFocus << "," << endl; + out << "\t\tNoFocus = " << Qt::NoFocus << ',' << endl; + out << "\t\tTabFocus = " << Qt::TabFocus << ',' << endl; + out << "\t\tClickFocus = " << Qt::ClickFocus << ',' << endl; + out << "\t\tStrongFocus = " << Qt::StrongFocus << ',' << endl; out << "\t\tWheelFocus = " << Qt::WheelFocus << endl; out << "\t};" << endl << endl; } @@ -877,7 +877,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN if (!ok) out << "\t/****** Property is of unsupported datatype" << endl; - out << "\t\t[id(" << id << ")"; + out << "\t\t[id(" << id << ')'; if (!property.isWritable()) out << ", readonly"; if (isBindable && property.isScriptable(o)) @@ -886,9 +886,9 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN out << ", nonbrowsable"; if (isBindable) out << ", requestedit"; - if (defProp == QString::fromLatin1(name.constData())) + if (defProp == QLatin1String(name)) out << ", uidefault"; - out << "] " << type << " " << name << ";" << endl; + out << "] " << type << ' ' << name << ';' << endl; if (!ok) out << "\t******/" << endl; @@ -939,7 +939,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN if (!ok) outBuffer += "\t/****** Slot parameter uses unsupported datatype\n"; - outBuffer += "\t\t[id(" + QString::number(id).toLatin1() + ")] " + type + " " + name + "(" + ptype + ");\n"; + outBuffer += "\t\t[id(" + QString::number(id).toLatin1() + ")] " + type + ' ' + name + '(' + ptype + ");\n"; if (!ok) outBuffer += "\t******/\n"; @@ -991,7 +991,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN QList<QByteArray> parameterTypes(signal.parameterTypes()); QList<QByteArray> parameterNames(signal.parameterNames()); - bool isDefault = defSignal == QString::fromLatin1(name.constData()); + bool isDefault = defSignal == QLatin1String(name); name = renameOverloads(replaceKeyword(name)); bool ok = true; @@ -1003,10 +1003,10 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN if (!ok) out << "\t/****** Signal parameter uses unsupported datatype" << endl; - out << "\t\t[id(" << id << ")"; + out << "\t\t[id(" << id << ')'; if (isDefault) out << ", uidefault"; - out << "] void " << name << "(" << ptype << ");" << endl; + out << "] void " << name << '(' << ptype << ");" << endl; if (!ok) out << "\t******/" << endl; @@ -1031,7 +1031,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN const char *classVersion = mo->classInfo(mo->indexOfClassInfo("Version")).value(); if (classVersion) out << "\t\tversion(" << classVersion << ")," << endl; - out << "\t\tuuid(" << classID << ")"; + out << "\t\tuuid(" << classID << ')'; if (control) { out << ", " << endl; out << "\t\tcontrol"; @@ -1043,7 +1043,7 @@ static HRESULT classIDL(QObject *o, const QMetaObject *mo, const QString &classN out << "\t]" << endl; out << "\tcoclass " << cleanClassName << endl; out << "\t{" << endl; - out << "\t\t[default] dispinterface I" << cleanClassName << ";" << endl; + out << "\t\t[default] dispinterface I" << cleanClassName << ';' << endl; if (hasEvents) out << "\t\t[default, source] dispinterface I" << cleanClassName << "Events;" << endl; out << "\t};" << endl; @@ -1068,7 +1068,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) file.remove(); QString filebase = QString::fromLocal8Bit(qAxModuleFilename); - filebase = filebase.left(filebase.lastIndexOf(QLatin1String("."))); + filebase = filebase.left(filebase.lastIndexOf(QLatin1Char('.'))); QString appID = qAxFactory()->appID().toString().toUpper(); if (QUuid(appID).isNull()) @@ -1103,7 +1103,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) out << "/****************************************************************************" << endl; out << "** Interface definition generated for ActiveQt project" << endl; out << "**" << endl; - out << "** '" << qAxModuleFilename << "'" << endl; + out << "** '" << qAxModuleFilename << '\'' << endl; out << "**" << endl; out << "** Created: " << QDateTime::currentDateTime().toString() << endl; out << "**" << endl; @@ -1121,13 +1121,13 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) delete_qApp = true; } - out << "[" << endl; + out << '[' << endl; out << "\tuuid(" << typeLibID << ")," << endl; out << "\tversion(" << version << ")," << endl; - out << "\thelpstring(\"" << typelib << " " << version << " Type Library\")" << endl; - out << "]" << endl; + out << "\thelpstring(\"" << typelib << ' ' << version << " Type Library\")" << endl; + out << ']' << endl; out << "library " << typelib << "Lib" << endl; - out << "{" << endl; + out << '{' << endl; out << "\timportlib(\"stdole32.tlb\");" << endl; out << "\timportlib(\"stdole2.tlb\");" << endl << endl; @@ -1188,11 +1188,12 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) // We have meta object information for this type. Forward declare it. if (mo) { QByteArray cleanType = qax_clean_type(*key, mo).toLatin1(); - out << "\tcoclass " << cleanType << ";" << endl; + out << "\tcoclass " << cleanType << ';' << endl; + subtypes.append(cleanType); + qRegisterMetaType(cleanType, (void**)0); + cleanType += '*'; subtypes.append(cleanType); - subtypes.append(cleanType + "*"); qRegisterMetaType(cleanType, (void**)0); - qRegisterMetaType(cleanType + "*", (void**)0); } } out << endl; @@ -1225,7 +1226,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) QByteArray cleanType = qax_clean_type(*key, mo).toLatin1(); subtypes.append(cleanType); - subtypes.append(cleanType + "*"); + subtypes.append(cleanType + '*'); res = classIDL(o, mo, QString::fromLatin1(className.constData()), isBindable, out); delete o; if (res != S_OK) diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index f3e1dff..19c2404 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -2446,10 +2446,10 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid, int nameLength = 0; if (index == -1) { nameLength = name.length(); - name += "("; + name += '('; // no parameter - shortcut if (!pDispParams->cArgs) - index = mo->indexOfSlot((name + ")")); + index = mo->indexOfSlot((name + ')')); // search if (index == -1) { for (int i = 0; i < mo->methodCount(); ++i) { @@ -2463,7 +2463,7 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid, if (index == -1) { QRegExp regexp(QLatin1String("_([0-9])\\(")); if (regexp.lastIndexIn(QString::fromLatin1(name.constData())) != -1) { - name = name.left(name.length() - regexp.cap(0).length()) + "("; + name = name.left(name.length() - regexp.cap(0).length()) + '('; int overload = regexp.cap(1).toInt() + 1; for (int s = 0; s < qt.object->metaObject()->methodCount(); ++s) { @@ -2559,7 +2559,7 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid, argv[p + 1] = varp + p + 1; } else { argv[p + 1] = const_cast<void*>(varp[p + 1].constData()); - if (ptype.endsWith("*")) { + if (ptype.endsWith('*')) { argv_pointer[p + 1] = argv[p + 1]; argv[p + 1] = argv_pointer + p + 1; } @@ -2590,7 +2590,7 @@ HRESULT WINAPI QAxServerBase::Invoke(DISPID dispidMember, REFIID riid, } else { argv[0] = const_cast<void*>(varp[0].constData()); } - if (type.endsWith("*")) { + if (type.endsWith('*')) { argv_pointer[0] = argv[0]; argv[0] = argv_pointer; } diff --git a/src/activeqt/control/qaxservermain.cpp b/src/activeqt/control/qaxservermain.cpp index a50fef0..e3e1e5d 100644 --- a/src/activeqt/control/qaxservermain.cpp +++ b/src/activeqt/control/qaxservermain.cpp @@ -253,7 +253,7 @@ EXTERN_C int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, run = false; break; } else { - unprocessed += cmds.at(i) + " "; + unprocessed += cmds.at(i) + ' '; } } diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp index ace81e7..12307f3 100644 --- a/src/activeqt/shared/qaxtypes.cpp +++ b/src/activeqt/shared/qaxtypes.cpp @@ -1111,7 +1111,7 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint if (iface) { QObject *qObj = iface->qObject(); iface->Release(); - var = QVariant(qRegisterMetaType<QObject*>(qObj ? QByteArray(qObj->metaObject()->className()) + "*" : typeName), &qObj); + var = QVariant(qRegisterMetaType<QObject*>(qObj ? QByteArray(qObj->metaObject()->className()) + '*' : typeName), &qObj); } else #endif { diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 8ea48d1..3c443ff 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -83,12 +83,12 @@ static QByteArray openModeToFopenMode(QIODevice::OpenMode flags, const QString & } else if (flags & QIODevice::WriteOnly) { mode = "wb"; if (flags & QIODevice::ReadOnly) - mode += "+"; + mode += '+'; } if (flags & QIODevice::Append) { mode = "ab"; if (flags & QIODevice::ReadOnly) - mode += "+"; + mode += '+'; } return mode; } @@ -723,7 +723,7 @@ QString QFSFileEngine::fileName(FileName file) const bool isDir = ret.endsWith(QLatin1Char('/')); ret = QDir::cleanPath(ret); if (isDir) - ret += QLatin1String("/"); + ret += QLatin1Char('/'); if (file == AbsolutePathName) { int slash = ret.lastIndexOf(QLatin1Char('/')); if (slash == -1) diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 0b87e2b..790f1eb 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -1770,10 +1770,10 @@ QString QFSFileEngine::fileName(FileName file) const if(slash == -1) { if(d->filePath.length() >= 2 && d->filePath.at(1) == QLatin1Char(':')) return d->filePath.left(2); - return QString::fromLatin1("."); + return QLatin1Char('.'); } else { if(!slash) - return QString::fromLatin1("/"); + return QLatin1Char('/'); if(slash == 2 && d->filePath.length() >= 2 && d->filePath.at(1) == QLatin1Char(':')) slash++; return d->filePath.left(slash); @@ -1831,7 +1831,7 @@ QString QFSFileEngine::fileName(FileName file) const if (slash == -1) ret = QDir::currentPath(); else if (slash == 0) - ret = QLatin1String("/"); + ret = QLatin1Char('/'); ret = ret.left(slash); } return ret; @@ -1893,7 +1893,7 @@ QString QFSFileEngine::owner(FileOwner own) const #else Q_UNUSED(own); #endif - return QString(QLatin1String("")); + return QString(); } bool QFSFileEngine::setPermissions(uint perms) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 94a53f1..5846e23 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -5330,7 +5330,7 @@ QString QUrl::toString(FormattingOptions options) const url += QLatin1Char('/'); url += ourPath; // check if we need to remove trailing slashes - while ((options & StripTrailingSlash) && url.right(1) == QLatin1String("/")) + while ((options & StripTrailingSlash) && url.endsWith(QLatin1Char('/'))) url.chop(1); } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 6847173..cb40f19 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1908,7 +1908,7 @@ QStringList QCoreApplication::arguments() wchar_t tempFilename[MAX_PATH+1]; if (GetModuleFileNameW(0, tempFilename, MAX_PATH)) { tempFilename[MAX_PATH] = 0; - cmdline.prepend(QLatin1Char('\"') + QString::fromUtf16((unsigned short *)tempFilename) + QString(QLatin1String("\" "))); + cmdline.prepend(QLatin1Char('\"') + QString::fromUtf16((unsigned short *)tempFilename) + QLatin1String("\" ")); } #endif // Q_OS_WINCE diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 9868c23..815a558 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -840,7 +840,7 @@ QString decodeMSG(const MSG& msg) FLGSTR(ISC_SHOWUICANDIDATEWINDOW << 2), FLGSTR(ISC_SHOWUICANDIDATEWINDOW << 3), FLAG_STRING()); - parameters.sprintf("Input context(%s) Show flags(%s)", (fSet?"Active":"Inactive"), showFlgs.toLatin1().data()); + parameters.sprintf("Input context(%s) Show flags(%s)", (fSet? "Active" : "Inactive"), showFlgs.toLatin1().data()); } break; #endif diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 08bd2d0..de1baac 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -71,7 +71,7 @@ static QString qdlerror() #else const char *err = strerror(errno); #endif - return err ? QLatin1String("(")+QString::fromLocal8Bit(err) + QLatin1String(")"): QString(); + return err ? QLatin1Char('(') + QString::fromLocal8Bit(err) + QLatin1Char(')'): QString(); } bool QLibraryPrivate::load_sys() diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 090ca61..de41360 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -4688,7 +4688,7 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos if (fixup && tmpstate == Intermediate && used < sn.count) { const FieldInfo fi = fieldInfo(index); if ((fi & (Numeric|FixedWidth)) == (Numeric|FixedWidth)) { - const QString newText = QString(QLatin1String("%1")).arg(num, sn.count, 10, QLatin1Char('0')); + const QString newText = QString::fromLatin1("%1").arg(num, sn.count, 10, QLatin1Char('0')); input.replace(pos, used, newText); used = sn.count; } diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 248137a..9953155 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -321,7 +321,7 @@ static QString readEscapedFormatString(const QString &format, int *idx) { int &i = *idx; - Q_ASSERT(format.at(i).unicode() == '\''); + Q_ASSERT(format.at(i) == QLatin1Char('\'')); ++i; if (i == format.size()) return QString(); @@ -635,7 +635,7 @@ static QLocale::MeasurementSystem winSystemMeasurementSystem() QString iMeasure = QT_WA_INLINE( QString::fromUtf16(reinterpret_cast<ushort*>(output)), QString::fromLocal8Bit(reinterpret_cast<char*>(output))); - if (iMeasure == QString::fromLatin1("1")) { + if (iMeasure == QLatin1String("1")) { return QLocale::ImperialSystem; } } diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index ff1a01f..5e1fec3 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -3058,7 +3058,7 @@ QXmlStreamPrivateTagStack::NamespaceDeclaration &QXmlStreamWriterPrivate::findNa QString s; int n = ++namespacePrefixCount; forever { - s = QLatin1String("n") + QString::number(n++); + s = QLatin1Char('n') + QString::number(n++); int j = namespaceDeclarations.size() - 2; while (j >= 0 && namespaceDeclarations.at(j).prefix != s) --j; diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp index 955a31c..2347a54 100644 --- a/src/dbus/qdbuserror.cpp +++ b/src/dbus/qdbuserror.cpp @@ -339,7 +339,7 @@ QString QDBusError::errorString(ErrorType error) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QDBusError &msg) { - dbg.nospace() << "QDBusError(" << msg.name() << ", " << msg.message() << ")"; + dbg.nospace() << "QDBusError(" << msg.name() << ", " << msg.message() << ')'; return dbg.space(); } #endif diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index f40a45f..33f44ab 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -74,7 +74,7 @@ static inline QDebug operator<<(QDebug dbg, const QThread *th) dbg.nospace() << "QThread(ptr=" << (void*)th; if (th && !th->objectName().isEmpty()) dbg.nospace() << ", name=" << th->objectName(); - dbg.nospace() << ")"; + dbg.nospace() << ')'; return dbg.space(); } @@ -90,7 +90,7 @@ static inline QDebug operator<<(QDebug dbg, const QDBusConnectionPrivate *conn) dbg.nospace() << "same thread"; else dbg.nospace() << conn->thread(); - dbg.nospace() << ")"; + dbg.nospace() << ')'; return dbg.space(); } @@ -565,7 +565,7 @@ static void huntAndEmit(DBusConnection *connection, DBusMessage *msg, QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = haystack.children.constBegin(); QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator end = haystack.children.constEnd(); for ( ; it != end; ++it) - huntAndEmit(connection, msg, needle, *it, isScriptable, isAdaptor, path + QLatin1String("/") + it->name); + huntAndEmit(connection, msg, needle, *it, isScriptable, isAdaptor, path + QLatin1Char('/') + it->name); if (needle == haystack.obj) { // is this a signal we should relay? diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 8eb8b1a..ce76ecc 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -601,7 +601,7 @@ QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, con // mark as an error error = QDBusError(QDBusError::UnknownInterface, - QString( QLatin1String("Interface '%1' was not found") ) + QString::fromLatin1("Interface '%1' was not found") .arg(interface)); return 0; } diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp index 471b899..dd983a0 100644 --- a/src/dbus/qdbusutil.cpp +++ b/src/dbus/qdbusutil.cpp @@ -80,15 +80,15 @@ static bool variantToString(const QVariant &arg, QString &out) int argType = arg.userType(); if (argType == QVariant::StringList) { - out += QLatin1String("{"); + out += QLatin1Char('{'); QStringList list = arg.toStringList(); foreach (QString item, list) out += QLatin1Char('\"') + item + QLatin1String("\", "); if (!list.isEmpty()) out.chop(2); - out += QLatin1String("}"); + out += QLatin1Char('}'); } else if (argType == QVariant::ByteArray) { - out += QLatin1String("{"); + out += QLatin1Char('{'); QByteArray list = arg.toByteArray(); for (int i = 0; i < list.count(); ++i) { out += QString::number(list.at(i)); @@ -96,9 +96,9 @@ static bool variantToString(const QVariant &arg, QString &out) } if (!list.isEmpty()) out.chop(2); - out += QLatin1String("}"); + out += QLatin1Char('}'); } else if (argType == QVariant::List) { - out += QLatin1String("{"); + out += QLatin1Char('{'); QList<QVariant> list = arg.toList(); foreach (QVariant item, list) { if (!variantToString(item, out)) @@ -107,7 +107,7 @@ static bool variantToString(const QVariant &arg, QString &out) } if (!list.isEmpty()) out.chop(2); - out += QLatin1String("}"); + out += QLatin1Char('}'); } else if (argType == QMetaType::Char || argType == QMetaType::Short || argType == QMetaType::Int || argType == QMetaType::Long || argType == QMetaType::LongLong) { out += QString::number(arg.toLongLong()); @@ -142,7 +142,7 @@ static bool variantToString(const QVariant &arg, QString &out) return false; out += QLatin1Char(']'); } else if (arg.canConvert(QVariant::String)) { - out += QLatin1String("\"") + arg.toString() + QLatin1String("\""); + out += QLatin1Char('\"') + arg.toString() + QLatin1Char('\"'); } else { out += QLatin1Char('['); out += QLatin1String(arg.typeName()); @@ -226,7 +226,7 @@ bool argToString(const QDBusArgument &busArg, QString &out) if (elementType != QDBusArgument::BasicType && elementType != QDBusArgument::VariantType && elementType != QDBusArgument::MapEntryType) - out += QLatin1String("]"); + out += QLatin1Char(']'); return true; } diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 87a4e65..8456d13 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -669,7 +669,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p) for (int i = 0; i < cupsPrinterCount; ++i) { QString printerName(QString::fromLocal8Bit(cupsPrinters[i].name)); if (cupsPrinters[i].instance) - printerName += QLatin1String("/") + QString::fromLocal8Bit(cupsPrinters[i].instance); + printerName += QLatin1Char('/') + QString::fromLocal8Bit(cupsPrinters[i].instance); widget.printers->addItem(printerName); if (cupsPrinters[i].is_default) @@ -813,7 +813,7 @@ void QUnixPrintWidgetPrivate::_q_printerChanged(int index) optionsPane->selectPrinter(0); #endif if (lprPrinters.count() > 0) { - QString type = lprPrinters.at(index).name + QLatin1String("@") + lprPrinters.at(index).host; + QString type = lprPrinters.at(index).name + QLatin1Char('@') + lprPrinters.at(index).host; if (!lprPrinters.at(index).comment.isEmpty()) type += QLatin1String(", ") + lprPrinters.at(index).comment; widget.type->setText(type); @@ -1194,9 +1194,9 @@ QVariant QPPDOptionsModel::headerData(int section, Qt::Orientation, int role) co switch(section){ case 0: - return QVariant(QApplication::translate("QPPDOptionsModel","Name")); + return QVariant(QApplication::translate("QPPDOptionsModel", "Name")); case 1: - return QVariant(QApplication::translate("QPPDOptionsModel","Value")); + return QVariant(QApplication::translate("QPPDOptionsModel", "Value")); default: return QVariant(); } diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp index 29a2738..a696160 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/gui/dialogs/qprintpreviewdialog.cpp @@ -460,7 +460,7 @@ void QPrintPreviewDialogPrivate::updatePageNumLabel() int numPages = preview->numPages(); int maxChars = QString::number(numPages).length(); - pageNumLabel->setText(QString(QLatin1String("/ %1")).arg(numPages)); + pageNumLabel->setText(QString::fromLatin1("/ %1").arg(numPages)); int cyphersWidth = q->fontMetrics().width(QString().fill(QLatin1Char('8'), maxChars)); int maxWidth = pageNumEdit->minimumSizeHint().width() + cyphersWidth; pageNumEdit->setMinimumWidth(maxWidth); @@ -611,7 +611,7 @@ void QPrintPreviewDialogPrivate::_q_zoomFactorChanged() factor = qMax(qreal(1.0), qMin(qreal(1000.0), factor)); if (ok) { preview->setZoomFactor(factor/100.0); - zoomFactor->setEditText(QString(QLatin1String("%1%")).arg(factor)); + zoomFactor->setEditText(QString::fromLatin1("%1%").arg(factor)); setFitting(false); } } diff --git a/src/gui/embedded/qmouse_qws.cpp b/src/gui/embedded/qmouse_qws.cpp index 044a574..b5eda0c 100644 --- a/src/gui/embedded/qmouse_qws.cpp +++ b/src/gui/embedded/qmouse_qws.cpp @@ -413,8 +413,8 @@ void QWSCalibratedMouseHandler::writeCalibration() QFile file(calFile); if (file.open(QIODevice::WriteOnly)) { QTextStream t(&file); - t << a << " " << b << " " << c << " "; - t << d << " " << e << " " << f << " " << s << endl; + t << a << ' ' << b << ' ' << c << ' '; + t << d << ' ' << e << ' ' << f << ' ' << s << endl; } else #endif { diff --git a/src/gui/embedded/qscreenmulti_qws.cpp b/src/gui/embedded/qscreenmulti_qws.cpp index 1914b44..a639e01 100644 --- a/src/gui/embedded/qscreenmulti_qws.cpp +++ b/src/gui/embedded/qscreenmulti_qws.cpp @@ -221,9 +221,9 @@ bool QMultiScreen::connect(const QString &displaySpec) { QString dSpec = displaySpec; if (dSpec.startsWith(QLatin1String("Multi:"), Qt::CaseInsensitive)) - dSpec = dSpec.mid(QString(QLatin1String("Multi:")).size()); + dSpec = dSpec.mid(QString::fromLatin1("Multi:").size()); - const QString displayIdSpec = QString(QLatin1String(" :%1")).arg(displayId); + const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId); if (dSpec.endsWith(displayIdSpec)) dSpec = dSpec.left(dSpec.size() - displayIdSpec.size()); diff --git a/src/gui/embedded/qscreentransformed_qws.cpp b/src/gui/embedded/qscreentransformed_qws.cpp index e22ea1f..01a18b3 100644 --- a/src/gui/embedded/qscreentransformed_qws.cpp +++ b/src/gui/embedded/qscreentransformed_qws.cpp @@ -206,11 +206,11 @@ bool QTransformedScreen::connect(const QString &displaySpec) { QString dspec = displaySpec.trimmed(); if (dspec.startsWith(QLatin1String("Transformed:"), Qt::CaseInsensitive)) - dspec = dspec.mid(QString(QLatin1String("Transformed:")).size()); + dspec = dspec.mid(QString::fromLatin1("Transformed:").size()); else if (!dspec.compare(QLatin1String("Transformed"), Qt::CaseInsensitive)) dspec = QString(); - const QString displayIdSpec = QString(QLatin1String(" :%1")).arg(displayId); + const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId); if (dspec.endsWith(displayIdSpec)) dspec = dspec.left(dspec.size() - displayIdSpec.size()); @@ -223,7 +223,7 @@ bool QTransformedScreen::connect(const QString &displaySpec) if (!QScreenDriverFactory::keys().contains(driver, Qt::CaseInsensitive)) if (!dspec.isEmpty()) - dspec.prepend(QLatin1String(":")); + dspec.prepend(QLatin1Char(':')); const int id = getDisplayId(dspec); QScreen *s = qt_get_screen(id, dspec.toLatin1().constData()); diff --git a/src/gui/embedded/qscreenvfb_qws.cpp b/src/gui/embedded/qscreenvfb_qws.cpp index accfe1f..ec393e3 100644 --- a/src/gui/embedded/qscreenvfb_qws.cpp +++ b/src/gui/embedded/qscreenvfb_qws.cpp @@ -330,7 +330,7 @@ void QVFbScreen::disconnect() bool QVFbScreen::initDevice() { #ifndef QT_NO_QWS_MOUSE_QVFB - const QString mouseDev = QString(QLatin1String(QT_VFB_MOUSE_PIPE)) + const QString mouseDev = QString::fromLatin1(QT_VFB_MOUSE_PIPE) .arg(displayId); d_ptr->mouse = new QVFbMouseHandler(QLatin1String("QVFbMouse"), mouseDev); qwsServer->setDefaultMouse("None"); @@ -339,7 +339,7 @@ bool QVFbScreen::initDevice() #endif #if !defined(QT_NO_QWS_KBD_QVFB) && !defined(QT_NO_QWS_KEYBOARD) - const QString keyboardDev = QString(QLatin1String(QT_VFB_KEYBOARD_PIPE)) + const QString keyboardDev = QString::fromLatin1(QT_VFB_KEYBOARD_PIPE) .arg(displayId); d_ptr->keyboard = new QVFbKeyboardHandler(keyboardDev); qwsServer->setDefaultKeyboard("None"); diff --git a/src/gui/embedded/qtransportauth_qws.cpp b/src/gui/embedded/qtransportauth_qws.cpp index 97ba5b8..6677482 100644 --- a/src/gui/embedded/qtransportauth_qws.cpp +++ b/src/gui/embedded/qtransportauth_qws.cpp @@ -834,12 +834,12 @@ QString RequestAnalyzer::analyze( QByteArray *msgQueue ) if ( command_type == QWSCommand::QCopSend ) { QWSQCopSendCommand *sendCommand = static_cast<QWSQCopSendCommand*>(command); - request += QString( QLatin1String("/QCop/%1/%2") ).arg( sendCommand->channel ).arg( sendCommand->message ); + request += QString::fromLatin1("/QCop/%1/%2").arg( sendCommand->channel ).arg( sendCommand->message ); } if ( command_type == QWSCommand::QCopRegisterChannel ) { QWSQCopRegisterChannelCommand *registerCommand = static_cast<QWSQCopRegisterChannelCommand*>(command); - request += QString( QLatin1String("/QCop/RegisterChannel/%1") ).arg( registerCommand->channel ); + request += QString::fromLatin1("/QCop/RegisterChannel/%1").arg( registerCommand->channel ); } #endif dataSize = QWS_PROTOCOL_ITEM_SIZE( *command ); diff --git a/src/gui/embedded/qunixsocket.cpp b/src/gui/embedded/qunixsocket.cpp index 16f2cae..1600505 100644 --- a/src/gui/embedded/qunixsocket.cpp +++ b/src/gui/embedded/qunixsocket.cpp @@ -135,7 +135,7 @@ struct QUnixSocketRightsPrivate : public QSharedData #ifdef QUNIXSOCKET_DEBUG if(0 != closerv) { qDebug() << "QUnixSocketRightsPrivate: Unable to close managed" - " file descriptor (" << ::strerror(errno) << ")"; + " file descriptor (" << ::strerror(errno) << ')'; } #endif } @@ -166,7 +166,7 @@ QUnixSocketRights::QUnixSocketRights(int fd) #ifdef QUNIXSOCKET_DEBUG if(-1 == d->fd) { qDebug() << "QUnixSocketRights: Unable to duplicate fd " - << fd << " (" << ::strerror(errno) << ")"; + << fd << " (" << ::strerror(errno) << ')'; } #endif } @@ -237,7 +237,7 @@ int QUnixSocketRights::dupFd() const #ifdef QUNIXSOCKET_DEBUG if(-1 == rv) qDebug() << "QUnixSocketRights: Unable to duplicate managed file " - "descriptor (" << ::strerror(errno) << ")"; + "descriptor (" << ::strerror(errno) << ')'; #endif return rv; @@ -927,7 +927,7 @@ bool QUnixSocket::connect(const QByteArray & path) int crv; #ifdef QUNIXSOCKET_DEBUG qDebug() << "QUnixSocket: Connect requested to '" - << path << "'"; + << path << '\''; #endif abort(); // Reset any existing connection @@ -949,7 +949,7 @@ bool QUnixSocket::connect(const QByteArray & path) if(-1 == d->fd) { #ifdef QUNIXSOCKET_DEBUG qDebug() << "QUnixSocket: Unable to create socket (" - << strerror(errno) << ")"; + << strerror(errno) << ')'; #endif d->error = ResourceError; goto connect_error; @@ -962,7 +962,7 @@ bool QUnixSocket::connect(const QByteArray & path) if(-1 == crv) { #ifdef QUNIXSOCKET_DEBUG qDebug() << "QUnixSocket: Unable to configure socket (" - << ::strerror(errno) << ")"; + << ::strerror(errno) << ')'; #endif d->error = ResourceError; @@ -981,7 +981,7 @@ bool QUnixSocket::connect(const QByteArray & path) if(-1 == crv) { #ifdef QUNIXSOCKET_DEBUG qDebug() << "QUnixSocket: Unable to connect (" - << ::strerror(errno) << ")"; + << ::strerror(errno) << ')'; #endif if(ECONNREFUSED == errno) d->error = ConnectionRefused; @@ -1021,7 +1021,7 @@ connect_error: // Cleanup failed connection #ifdef QUNIXSOCKET_DEBUG if(0 != closerv) { qDebug() << "QUnixSocket: Unable to close file descriptor after " - "failed connect (" << ::strerror(errno) << ")"; + "failed connect (" << ::strerror(errno) << ')'; } #endif } @@ -1065,7 +1065,7 @@ bool QUnixSocket::setSocketDescriptor(int socketDescriptor) if(-1 == crv) { #ifdef QUNIXSOCKET_DEBUG qDebug() << "QUnixSocket: Unable to configure client provided socket (" - << ::strerror(errno) << ")"; + << ::strerror(errno) << ')'; #endif d->error = ResourceError; @@ -1136,7 +1136,7 @@ void QUnixSocket::abort() #ifdef QUNIXSOCKET_DEBUG if(0 != closerv) { qDebug() << "QUnixSocket: Unable to close socket during abort (" - << strerror(errno) << ")"; + << strerror(errno) << ')'; } #endif @@ -1686,11 +1686,11 @@ qint64 QUnixSocketPrivate::writeActivated() } #ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Transmitting message (length" << m.d->size() << ")"; + qDebug() << "QUnixSocket: Transmitting message (length" << m.d->size() << ')'; #endif ::ssize_t s = ::sendmsg(fd, &sendmessage, MSG_DONTWAIT | MSG_NOSIGNAL); #ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Transmitted message (" << s << ")"; + qDebug() << "QUnixSocket: Transmitted message (" << s << ')'; #endif if(-1 == s) { @@ -1699,13 +1699,13 @@ qint64 QUnixSocketPrivate::writeActivated() } else if(EPIPE == errno) { #ifdef QUNIXSOCKET_DEBUG qDebug() << "QUnixSocket: Remote side disconnected during transmit " - "(" << ::strerror(errno) << ")"; + "(" << ::strerror(errno) << ')'; #endif me->abort(); } else { #ifdef QUNIXSOCKET_DEBUG qDebug() << "QUnixSocket: Unable to transmit data (" - << ::strerror(errno) << ")"; + << ::strerror(errno) << ')'; #endif error = (QUnixSocket::SocketError)(QUnixSocket::WriteFailure | CausedAbort); @@ -1764,12 +1764,12 @@ void QUnixSocketPrivate::readActivated() int recvrv = ::recvmsg(fd, &message, 0); #ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Received message (" << recvrv << ")"; + qDebug() << "QUnixSocket: Received message (" << recvrv << ')'; #endif if(-1 == recvrv) { #ifdef QUNIXSOCKET_DEBUG qDebug() << "QUnixSocket: Unable to receive data (" - << ::strerror(errno) << ")"; + << ::strerror(errno) << ')'; #endif error = (QUnixSocket::SocketError)(QUnixSocket::ReadFailure | CausedAbort); diff --git a/src/gui/embedded/qunixsocketserver.cpp b/src/gui/embedded/qunixsocketserver.cpp index 6e9347b..489c40a 100644 --- a/src/gui/embedded/qunixsocketserver.cpp +++ b/src/gui/embedded/qunixsocketserver.cpp @@ -172,7 +172,7 @@ void QUnixSocketServer::close() #ifdef QUNIXSOCKET_DEBUG if(0 != closerv) { qDebug() << "QUnixSocketServer: Unable to close socket (" - << strerror(errno) << ")"; + << strerror(errno) << ')'; } #endif } @@ -245,7 +245,7 @@ bool QUnixSocketServer::listen(const QByteArray & path) if(-1 == d->fd) { #ifdef QUNIXSOCKETSERVER_DEBUG qDebug() << "QUnixSocketServer: Unable to create socket (" - << strerror(errno) << ")"; + << strerror(errno) << ')'; #endif close(); d->error = ResourceError; @@ -263,7 +263,7 @@ bool QUnixSocketServer::listen(const QByteArray & path) if(-1 == ::bind(d->fd, (sockaddr *)&addr, sizeof(sockaddr_un))) { #ifdef QUNIXSOCKETSERVER_DEBUG qDebug() << "QUnixSocketServer: Unable to bind socket (" - << strerror(errno) << ")"; + << strerror(errno) << ')'; #endif close(); d->error = BindError; @@ -274,7 +274,7 @@ bool QUnixSocketServer::listen(const QByteArray & path) if(-1 == ::listen(d->fd, d->maxConns)) { #ifdef QUNIXSOCKETSERVER_DEBUG qDebug() << "QUnixSocketServer: Unable to listen socket (" - << strerror(errno) << ")"; + << strerror(errno) << ')'; #endif close(); d->error = ListenError; diff --git a/src/gui/embedded/qwindowsystem_qws.cpp b/src/gui/embedded/qwindowsystem_qws.cpp index fdcd193..a15decd 100644 --- a/src/gui/embedded/qwindowsystem_qws.cpp +++ b/src/gui/embedded/qwindowsystem_qws.cpp @@ -2210,7 +2210,7 @@ void QWSServer::sendMouseEvent(const QPoint& pos, int state, int wheel) { bool block = qwsServerPrivate->screensaverblockevent(MOUSE, qwsServerPrivate->screensaverinterval, state); #ifdef EVENT_BLOCK_DEBUG - qDebug() << "sendMouseEvent" << pos.x() << pos.y() << state << (block?"block":"pass"); + qDebug() << "sendMouseEvent" << pos.x() << pos.y() << state << (block ? "block" : "pass"); #endif if (state || wheel) @@ -4110,7 +4110,7 @@ void QWSServer::processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers block = qwsServerPrivate->screensaverblockevent(KEY, qwsServerPrivate->screensaverinterval, isPress); #ifdef EVENT_BLOCK_DEBUG - qDebug() << "processKeyEvent" << unicode << keycode << modifiers << isPress << autoRepeat << (block?"block":"pass"); + qDebug() << "processKeyEvent" << unicode << keycode << modifiers << isPress << autoRepeat << (block ? "block" : "pass"); #endif // If we press a key and it's going to be blocked, wake up the screen diff --git a/src/gui/embedded/qwscommand_qws.cpp b/src/gui/embedded/qwscommand_qws.cpp index b0fd78b..26d3435 100644 --- a/src/gui/embedded/qwscommand_qws.cpp +++ b/src/gui/embedded/qwscommand_qws.cpp @@ -133,7 +133,7 @@ void QWSHexDump::init() void QWSHexDump::hexDump() { - *outstrm << "(" << dataSize << " bytes):\n" << prefix; + *outstrm << '(' << dataSize << " bytes):\n" << prefix; sprintf(sideviewLayout, " [%%-%us]", wrap); dataWidth = (2 * wrap) + (wrap / clustering); @@ -144,7 +144,7 @@ void QWSHexDump::hexDump() sideview[wrapIndex = i%wrap] = isprint(c) ? c : '.'; if (wrapIndex && (wrapIndex % clustering == 0)) - *outstrm << " "; + *outstrm << ' '; outstrm->setFieldWidth(2); outstrm->setPadChar('0'); @@ -172,14 +172,14 @@ void QWSHexDump::sideviewDump(int at) int currentWidth = (2 * at) + (at / clustering) - (at%clustering?0:1); int missing = qMax(dataWidth - currentWidth, 0); while (missing--) - *outstrm << " "; + *outstrm << ' '; *outstrm << " ["; outstrm->setPadChar(' '); outstrm->setFieldWidth(wrap); outstrm->setFieldAlignment( QTextStream::AlignLeft ); *outstrm << sideview; - *outstrm << "]"; + *outstrm << ']'; } } diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 1125610..ea52e11 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -194,7 +194,7 @@ QString qws_dataDir() static QString result; if (!result.isEmpty()) return result; - QByteArray dataDir = QString(QLatin1String("/tmp/qtembedded-%1")).arg(qws_display_id).toLocal8Bit(); + QByteArray dataDir = QString::fromLatin1("/tmp/qtembedded-%1").arg(qws_display_id).toLocal8Bit(); if (QT_MKDIR(dataDir, 0700)) { if (errno != EEXIST) { qFatal("Cannot create Qt for Embedded Linux data directory: %s", dataDir.constData()); @@ -215,7 +215,7 @@ QString qws_dataDir() if ((buf.st_mode & 0677) != 0600) qFatal("Qt for Embedded Linux data directory has incorrect permissions: %s", dataDir.constData()); #endif - dataDir += "/"; + dataDir += '/'; result = QString::fromLocal8Bit(dataDir); return result; @@ -224,7 +224,7 @@ QString qws_dataDir() // Get the filename of the pipe Qt for Embedded Linux uses for server/client comms Q_GUI_EXPORT QString qws_qtePipeFilename() { - return (qws_dataDir() + QString(QLatin1String(QTE_PIPE)).arg(qws_display_id)); + return (qws_dataDir() + QString::fromLatin1(QTE_PIPE).arg(qws_display_id)); } static void setMaxWindowRect(const QRect &rect) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 39f7335..670058b 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -955,8 +955,8 @@ const QString qt_reg_winclass(QWidget *w) // register window class wchar_t uniqueAppID[256]; GetModuleFileNameW(0, uniqueAppID, 255); cname = QString::number(RegisterWindowMessageW( - (const wchar_t *) QString::fromUtf16((const ushort *)uniqueAppID).toLower().replace(QString(QString::fromLatin1("\\")), - QString(QString::fromLatin1("_"))).utf16())); + (const wchar_t *) QString::fromUtf16((const ushort *)uniqueAppID).toLower().replace(QLatin1Char('\\'), + QLatin1Char('_')).utf16())); #endif // since multiple Qt versions can be used in one process diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp index b2eeb5c..9cb8b61 100644 --- a/src/gui/kernel/qmime_mac.cpp +++ b/src/gui/kernel/qmime_mac.cpp @@ -218,7 +218,7 @@ QString QMacPasteboardMimeAny::flavorFor(const QString &mime) if(mime == QLatin1String("application/x-qt-mime-type-name")) return QString(); QString ret = QLatin1String("com.trolltech.anymime.") + mime; - return ret.replace(QLatin1String("/"), QLatin1String("--")); + return ret.replace(QLatin1Char('/'), QLatin1String("--")); } QString QMacPasteboardMimeAny::mimeFor(QString flav) @@ -394,7 +394,7 @@ QString QMacPasteboardMimeUnicodeText::flavorFor(const QString &mime) int i = mime.indexOf(QLatin1String("charset=")); if (i >= 0) { QString cs(mime.mid(i+8).toLower()); - i = cs.indexOf(QLatin1String(";")); + i = cs.indexOf(QLatin1Char(';')); if (i>=0) cs = cs.left(i); if (cs == QLatin1String("system")) diff --git a/src/gui/kernel/qmime_win.cpp b/src/gui/kernel/qmime_win.cpp index 109ce20..ad2dec1 100644 --- a/src/gui/kernel/qmime_win.cpp +++ b/src/gui/kernel/qmime_win.cpp @@ -1262,16 +1262,16 @@ QVector<FORMATETC> QLastResortMimes::formatsForMime(const QString &mimeType, con } return formatetcs; } -static const char *x_qt_windows_mime = "application/x-qt-windows-mime;value=\""; +static const char x_qt_windows_mime[] = "application/x-qt-windows-mime;value=\""; -bool isCustomMimeType(const QString &mimeType) +static bool isCustomMimeType(const QString &mimeType) { return mimeType.startsWith(QLatin1String(x_qt_windows_mime), Qt::CaseInsensitive); } -QString customMimeType(const QString &mimeType) +static QString customMimeType(const QString &mimeType) { - int len = QString(QLatin1String(x_qt_windows_mime)).length(); + int len = sizeof(x_qt_windows_mime) - 1; int n = mimeType.lastIndexOf(QLatin1Char('\"'))-len; return mimeType.mid(len, n); } diff --git a/src/gui/kernel/qsound_qws.cpp b/src/gui/kernel/qsound_qws.cpp index e83935f..661544f 100644 --- a/src/gui/kernel/qsound_qws.cpp +++ b/src/gui/kernel/qsound_qws.cpp @@ -279,7 +279,7 @@ QAuBucketQWS::QAuBucketQWS( QAuServerQWS *server, QSound *sound, QObject* parent sound->setObjectName( m_id.toString() ); - m_channel = new QCopChannel(QString( QLatin1String("QPE/QSound/") ).append( m_id ), this ); + m_channel = new QCopChannel(QLatin1String("QPE/QSound/") + m_id ), this ); connect( m_channel, SIGNAL(received(QString,QByteArray)), this, SLOT(processMessage(QString,QByteArray)) ); diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 7ed521e..6a206ee 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -673,10 +673,10 @@ static int IntersectBB(const QBezier &a, const QBezier &b) #ifdef QDEBUG_BEZIER static QDebug operator<<(QDebug dbg, const QBezier &bz) { - dbg <<"["<<bz.x1<<", "<<bz.y1<<"], " - <<"["<<bz.x2<<", "<<bz.y2<<"], " - <<"["<<bz.x3<<", "<<bz.y3<<"], " - <<"["<<bz.x4<<", "<<bz.y4<<"]"; + dbg << '[' << bz.x1<< ", " << bz.y1 << "], " + << '[' << bz.x2 <<", " << bz.y2 << "], " + << '[' << bz.x3 <<", " << bz.y3 << "], " + << '[' << bz.x4 <<", " << bz.y4 << ']'; return dbg; } #endif diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 93e0db0..3f85095 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -6204,7 +6204,7 @@ void dumpClip(int width, int height, QClipData *clip) Q_ASSERT(x1 >= 0); fprintf(stderr,"clip %d: %d %d - %d %d\n", counter, x0, y0, x1, y1); - clipImg.save(QString(QLatin1String("clip-%0.png")).arg(counter++)); + clipImg.save(QString::fromLatin1("clip-%0.png").arg(counter++)); } #endif diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/gui/painting/qprinterinfo_unix.cpp index 0f33ea7..5724173 100644 --- a/src/gui/painting/qprinterinfo_unix.cpp +++ b/src/gui/painting/qprinterinfo_unix.cpp @@ -822,7 +822,7 @@ QList<QPrinterInfo> QPrinterInfo::availablePrinters() for (int i = 0; i < cupsPrinterCount; ++i) { QString printerName(QString::fromLocal8Bit(cupsPrinters[i].name)); if (cupsPrinters[i].instance) - printerName += QLatin1String("/") + QString::fromLocal8Bit(cupsPrinters[i].instance); + printerName += QLatin1Char('/') + QString::fromLocal8Bit(cupsPrinters[i].instance); list.append(QPrinterInfo(printerName)); if (cupsPrinters[i].is_default) list[i].d_ptr->m_default = true; @@ -893,7 +893,7 @@ QPrinterInfo::QPrinterInfo(const QPrinter& printer) for (int i = 0; i < cupsPrinterCount; ++i) { QString printerName(QString::fromLocal8Bit(cupsPrinters[i].name)); if (cupsPrinters[i].instance) - printerName += QLatin1String("/") + QString::fromLocal8Bit(cupsPrinters[i].instance); + printerName += QLatin1Char('/') + QString::fromLocal8Bit(cupsPrinters[i].instance); if (printerName == printer.printerName()) { if (cupsPrinters[i].is_default) d->m_default = true; diff --git a/src/gui/painting/qtessellator.cpp b/src/gui/painting/qtessellator.cpp index b743940..9b5efee 100644 --- a/src/gui/painting/qtessellator.cpp +++ b/src/gui/painting/qtessellator.cpp @@ -1273,7 +1273,7 @@ QRectF QTessellator::tessellate(const QPointF *points, int nPoints) << "p0= (" << Q27Dot5ToDouble(d->scanline.edges[i]->v0->x) << '/' << Q27Dot5ToDouble(d->scanline.edges[i]->v0->y) << ") p1= (" << Q27Dot5ToDouble(d->scanline.edges[i]->v1->x) - << '/' << Q27Dot5ToDouble(d->scanline.edges[i]->v1->y) << ")" + << '/' << Q27Dot5ToDouble(d->scanline.edges[i]->v1->y) << ')' << "x=" << Q27Dot5ToDouble(d->scanline.edges[i]->positionAt(d->y)) << "isLeftOfNext=" << ((i < d->scanline.size - 1) diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index 9e8b498..f29d627 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -128,7 +128,7 @@ void QX11WindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint return; // qDebug() << "XSetClipRectangles"; // for (int i = 0; i < num; ++i) -// qDebug() << " " << i << rects[i].x << rects[i].x << rects[i].y << rects[i].width << rects[i].height; +// qDebug() << ' ' << i << rects[i].x << rects[i].x << rects[i].y << rects[i].width << rects[i].height; XSetClipRectangles(X11->display, gc, 0, 0, rects, num, YXBanded); XCopyArea(X11->display, d_ptr->device.handle(), widget->handle(), gc, br.x() + offset.x(), br.y() + offset.y(), br.width(), br.height(), wbr.x(), wbr.y()); diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp index 07cec93..f92fd0e 100644 --- a/src/gui/styles/gtksymbols.cpp +++ b/src/gui/styles/gtksymbols.cpp @@ -374,8 +374,8 @@ static QString getThemeName() while(!in.atEnd()) { QString line = in.readLine(); if (line.contains(QLS("gtk-theme-name"))) { - line = line.right(line.length() - line.indexOf(QLS("=")) - 1); - line.remove(QLS("\"")); + line = line.right(line.length() - line.indexOf(QLatin1Char('=')) - 1); + line.remove(QLatin1Char('\"')); line = line.trimmed(); themeName = line; break; @@ -695,7 +695,7 @@ void QGtk::initGtkWidgets() QHashIterator<QString, GtkWidget*> it(oldMap); while (it.hasNext()) { it.next(); - if (!it.key().contains(QLS("."))) { + if (!it.key().contains(QLatin1Char('.'))) { add_all_sub_widgets(it.value()); } } diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 0e54af8..151dab0 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1776,8 +1776,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QString key; + if (option->state & State_HasFocus) { - key = QLS("f"); + key += QLatin1Char('f'); GTK_WIDGET_SET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS); } diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp index f62a6d1..9a29de2 100644 --- a/src/gui/text/qfontdatabase_qws.cpp +++ b/src/gui/text/qfontdatabase_qws.cpp @@ -767,8 +767,8 @@ QFontEngine *loadSingleEngine(int script, const QFontPrivate *fp, QString fn = qwsFontPath(); fn += QLatin1Char('/'); fn += family->name.toLower() - + QLatin1String("_") + QString::number(pixelSize*10) - + QLatin1String("_") + QString::number(style->key.weight) + + QLatin1Char('_') + QString::number(pixelSize*10) + + QLatin1Char('_') + QString::number(style->key.weight) + (style->key.style == QFont::StyleItalic ? QLatin1String("i.qpf") : QLatin1String(".qpf")); //###rotation ### diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index 70e1599..605a7dd 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -509,9 +509,9 @@ bool qt_fillFontDef(const QByteArray &xlfd, QFontDef *fd, int dpi, QtFontDesc *d fd->styleStrategy |= QFont::NoAntialias; fd->family = QString::fromLatin1(tokens[Family]); QString foundry = QString::fromLatin1(tokens[Foundry]); - if (! foundry.isEmpty() && foundry != QString::fromLatin1("*") && (!desc || desc->family->count > 1)) + if (! foundry.isEmpty() && foundry != QLatin1String("*") && (!desc || desc->family->count > 1)) fd->family += - QString::fromLatin1(" [") + foundry + QString::fromLatin1("]"); + QLatin1String(" [") + foundry + QLatin1Char(']'); if (qstrlen(tokens[AddStyle]) > 0) fd->addStyle = QString::fromLatin1(tokens[AddStyle]); @@ -1802,30 +1802,30 @@ QFontEngine *QFontDatabase::loadXlfd(int screen, int script, const QFontDef &req QByteArray xlfd("-"); xlfd += desc.foundry->name.isEmpty() ? QByteArray("*") : desc.foundry->name.toLatin1(); - xlfd += "-"; + xlfd += '-'; xlfd += desc.family->name.isEmpty() ? QByteArray("*") : desc.family->name.toLatin1(); - xlfd += "-"; + xlfd += '-'; xlfd += desc.style->weightName ? desc.style->weightName : "*"; - xlfd += "-"; + xlfd += '-'; xlfd += (desc.style->key.style == QFont::StyleItalic - ? "i" - : (desc.style->key.style == QFont::StyleOblique ? "o" : "r")); - xlfd += "-"; + ? 'i' + : (desc.style->key.style == QFont::StyleOblique ? 'o' : 'r')); + xlfd += '-'; xlfd += desc.style->setwidthName ? desc.style->setwidthName : "*"; // ### handle add-style xlfd += "-*-"; xlfd += QByteArray::number(px); - xlfd += "-"; + xlfd += '-'; xlfd += QByteArray::number(desc.encoding->xpoint); - xlfd += "-"; + xlfd += '-'; xlfd += QByteArray::number(desc.encoding->xres); - xlfd += "-"; + xlfd += '-'; xlfd += QByteArray::number(desc.encoding->yres); - xlfd += "-"; + xlfd += '-'; xlfd += desc.encoding->pitch; - xlfd += "-"; + xlfd += '-'; xlfd += QByteArray::number(desc.encoding->avgwidth); - xlfd += "-"; + xlfd += '-'; xlfd += xlfd_for_id(desc.encoding->encoding); FM_DEBUG(" using XLFD: %s\n", xlfd.data()); diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index b7d1c59..28eb362 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -308,7 +308,7 @@ QFontEngineQPF::QFontEngineQPF(const QFontDef &def, int fileDescriptor, QFontEng readOnly = true; #if defined(DEBUG_FONTENGINE) - qDebug() << "QFontEngineQPF::QFontEngineQPF( fd =" << fd << ", renderingFontEngine =" << renderingFontEngine << ")"; + qDebug() << "QFontEngineQPF::QFontEngineQPF( fd =" << fd << ", renderingFontEngine =" << renderingFontEngine << ')'; #endif #ifndef QT_FONTS_ARE_RESOURCES @@ -316,11 +316,11 @@ QFontEngineQPF::QFontEngineQPF(const QFontDef &def, int fileDescriptor, QFontEng if (!renderingFontEngine) return; - fileName = fontDef.family.toLower() + QLatin1String("_") + fileName = fontDef.family.toLower() + QLatin1Char('_') + QString::number(fontDef.pixelSize) - + QLatin1String("_") + QString::number(fontDef.weight) + + QLatin1Char('_') + QString::number(fontDef.weight) + (fontDef.style != QFont::StyleNormal ? - QLatin1String("_italic") : QLatin1String("")) + QLatin1String("_italic") : QLatin1String()) + QLatin1String(".qsf"); fileName.replace(QLatin1Char(' '), QLatin1Char('_')); fileName.prepend(qws_fontCacheDir()); @@ -550,7 +550,7 @@ bool QFontEngineQPF::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph #if 0 && defined(DEBUG_FONTENGINE) QChar c(uc); if (!findGlyph(glyphs[glyph_pos].glyph) && !seenGlyphs.contains(c)) - qDebug() << "glyph for character" << c << "/" << hex << uc << "is" << dec << glyphs[glyph_pos].glyph; + qDebug() << "glyph for character" << c << '/' << hex << uc << "is" << dec << glyphs[glyph_pos].glyph; seenGlyphs.insert(c); #endif diff --git a/src/gui/text/qfontengine_x11.cpp b/src/gui/text/qfontengine_x11.cpp index 0972b2b..bafc99d 100644 --- a/src/gui/text/qfontengine_x11.cpp +++ b/src/gui/text/qfontengine_x11.cpp @@ -227,7 +227,7 @@ static QFontEngine::FaceId fontFile(const QByteArray &_xname, QFreetypeFace **fr QByteArray best_mapping; for (QStringList::ConstIterator it = fontpath.constBegin(); it != fontpath.constEnd(); ++it) { - if ((*it).left(1) != QLatin1String("/")) + if (!(*it).startsWith(QLatin1Char('/'))) continue; // not a path name, a font server QString fontmapname; int num = 0; @@ -693,9 +693,8 @@ QFontEngine::FaceId QFontEngineXLFD::faceId() const if (freetype) { const_cast<QFontEngineXLFD *>(this)->fsType = freetype->fsType(); } else { - QFontEngine::Properties properties = QFontEngine::properties(); face_id.index = 0; - face_id.filename = "-" + properties.postscriptName; + face_id.filename = '-' + QFontEngine::properties().postscriptName; } } #endif diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index c66d0c1..fa032e6 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2500,7 +2500,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi LDEBUG << "layoutBlock from=" << layoutFrom << "to=" << layoutTo; -// qDebug() << "layoutBlock; width" << layoutStruct->x_right - layoutStruct->x_left << "(maxWidth is btw" << tl->maximumWidth() << ")"; +// qDebug() << "layoutBlock; width" << layoutStruct->x_right - layoutStruct->x_left << "(maxWidth is btw" << tl->maximumWidth() << ')'; if (previousBlockFormat) { qreal margin = qMax(blockFormat.topMargin(), previousBlockFormat->bottomMargin()); diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index b1f1b75..ee743dc 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -499,7 +499,7 @@ void QTextHtmlParser::dumpHtml() { for (int i = 0; i < count(); ++i) { qDebug().nospace() << qPrintable(QString(depth(i)*4, QLatin1Char(' '))) - << qPrintable(at(i).tag) << ":" + << qPrintable(at(i).tag) << ':' << quoteNewline(at(i).text); ; } diff --git a/src/gui/util/qdesktopservices_mac.cpp b/src/gui/util/qdesktopservices_mac.cpp index fdafa1e..fb1e193 100644 --- a/src/gui/util/qdesktopservices_mac.cpp +++ b/src/gui/util/qdesktopservices_mac.cpp @@ -154,7 +154,7 @@ QString QDesktopServices::storageLocation(StandardLocation type) QString appName = QCoreApplication::applicationName(); if (!appName.isEmpty() && (QDesktopServices::DataLocation == type || QDesktopServices::CacheLocation == type)) - path += QLatin1String("/") + appName; + path += QLatin1Char('/') + appName; return path; } diff --git a/src/gui/util/qdesktopservices_x11.cpp b/src/gui/util/qdesktopservices_x11.cpp index b3486e8..8c4a597 100644 --- a/src/gui/util/qdesktopservices_x11.cpp +++ b/src/gui/util/qdesktopservices_x11.cpp @@ -164,8 +164,8 @@ QString QDesktopServices::storageLocation(StandardLocation type) QString key = lst.at(1); QString value = lst.at(2); if (value.length() > 2 - && value.startsWith(QLatin1String("\"")) - && value.endsWith(QLatin1String("\""))) + && value.startsWith(QLatin1Char('\"')) + && value.endsWith(QLatin1Char('\"'))) value = value.mid(1, value.length() - 2); // Store the key and value: "DESKTOP", "$HOME/Desktop" lines[key] = value; diff --git a/src/gui/widgets/qcombobox_p.h b/src/gui/widgets/qcombobox_p.h index ee0da62..0998e52 100644 --- a/src/gui/widgets/qcombobox_p.h +++ b/src/gui/widgets/qcombobox_p.h @@ -290,7 +290,7 @@ public: QComboBoxDelegate(QObject *parent, QComboBox *cmb) : QItemDelegate(parent), mCombo(cmb) {} static bool isSeparator(const QModelIndex &index) { - return index.data(Qt::AccessibleDescriptionRole).toString() == QString::fromLatin1("separator"); + return index.data(Qt::AccessibleDescriptionRole).toString() == QLatin1String("separator"); } static void setSeparator(QAbstractItemModel *model, const QModelIndex &index) { model->setData(index, QString::fromLatin1("separator"), Qt::AccessibleDescriptionRole); diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp index cdb3836..804220d 100644 --- a/src/gui/widgets/qprogressbar.cpp +++ b/src/gui/widgets/qprogressbar.cpp @@ -448,19 +448,19 @@ QString QProgressBar::text() const qint64 totalSteps = qint64(d->maximum) - qint64(d->minimum); QString result = d->format; - result.replace(QLatin1String("%m"), QString::fromLatin1("%1").arg(totalSteps)); - result.replace(QLatin1String("%v"), QString::fromLatin1("%1").arg(d->value)); + result.replace(QLatin1String("%m"), QString::number(totalSteps)); + result.replace(QLatin1String("%v"), QString::number(d->value)); // If max and min are equal and we get this far, it means that the // progress bar has one step and that we are on that step. Return // 100% here in order to avoid division by zero further down. if (totalSteps == 0) { - result.replace(QLatin1String("%p"), QString::fromLatin1("%1").arg(100)); + result.replace(QLatin1String("%p"), QString::number(100)); return result; } int progress = int(((qreal(d->value) - qreal(d->minimum)) * 100.0) / totalSteps); - result.replace(QLatin1String("%p"), QString::fromLatin1("%1").arg(progress)); + result.replace(QLatin1String("%p"), QString::number(progress)); return result; } diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index 7df68fc..b9b9d84 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -127,11 +127,11 @@ QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request { QByteArray ba = request.d->methodName(); QByteArray uri = request.d->uri(throughProxy); - ba += " " + uri; + ba += ' ' + uri; QString majorVersion = QString::number(request.majorVersion()); QString minorVersion = QString::number(request.minorVersion()); - ba += " HTTP/" + majorVersion.toLatin1() + "." + minorVersion.toLatin1() + "\r\n"; + ba += " HTTP/" + majorVersion.toLatin1() + '.' + minorVersion.toLatin1() + "\r\n"; QList<QPair<QByteArray, QByteArray> > fields = request.header(); QList<QPair<QByteArray, QByteArray> >::const_iterator it = fields.constBegin(); diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 6374fde..d905b70 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -109,7 +109,7 @@ void QNetworkAccessFileBackend::open() QString fileName = url.toLocalFile(); if (fileName.isEmpty()) { if (url.scheme() == QLatin1String("qrc")) - fileName = QLatin1String(":") + url.path(); + fileName = QLatin1Char(':') + url.path(); else fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); } diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 67df526..29bf042 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -1026,7 +1026,7 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug s, const QNetworkCookie &cookie) { - s.nospace() << "QNetworkCookie(" << cookie.toRawForm(QNetworkCookie::Full) << ")"; + s.nospace() << "QNetworkCookie(" << cookie.toRawForm(QNetworkCookie::Full) << ')'; return s.space(); } #endif diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 33795aa..b672765 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -511,13 +511,13 @@ QByteArray QAuthenticatorPrivate::digestMd5Response(const QByteArray &challenge, credentials += "uri=\"" + path + "\", "; if (!opaque.isEmpty()) credentials += "opaque=\"" + opaque + "\", "; - credentials += "response=\"" + response + "\""; + credentials += "response=\"" + response + '\"'; if (!options.value("algorithm").isEmpty()) credentials += ", algorithm=" + options.value("algorithm"); if (!options.value("qop").isEmpty()) { credentials += ", qop=" + qop + ", "; credentials += "nc=" + nonceCountString + ", "; - credentials += "cnonce=\"" + cnonce + "\""; + credentials += "cnonce=\"" + cnonce + '\"'; } return credentials; diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index b225c17..c2fb690 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -1078,7 +1078,7 @@ QPair<QHostAddress, int> QHostAddress::parseSubnet(const QString &subnet) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug d, const QHostAddress &address) { - d.maybeSpace() << "QHostAddress(" << address.toString() << ")"; + d.maybeSpace() << "QHostAddress(" << address.toString() << ')'; return d.space(); } #endif diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 960999e..f12b0c0 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -594,7 +594,7 @@ static inline QDebug operator<<(QDebug debug, const QNetworkAddressEntry &entry) debug.nospace() << ", netmask = " << entry.netmask(); if (!entry.broadcast().isNull()) debug.nospace() << ", broadcast = " << entry.broadcast(); - debug.nospace() << ")"; + debug.nospace() << ')'; return debug.space(); } diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 4bb12e6..2d37e2e 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -852,7 +852,7 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo) if (i != 0) s += ", "; s += addresses.at(i).toString(); } - s += "}"; + s += '}'; qDebug("QAbstractSocketPrivate::_q_startConnecting(hostInfo == %s)", s.toLatin1().constData()); #endif @@ -2596,7 +2596,7 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QAbstractSocket::SocketError er debug << "QAbstractSocket::ProxyProtocolError"; break; default: - debug << "QAbstractSocket::SocketError(" << int(error) << ")"; + debug << "QAbstractSocket::SocketError(" << int(error) << ')'; break; } return debug; @@ -2627,7 +2627,7 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QAbstractSocket::SocketState st debug << "QAbstractSocket::ClosingState"; break; default: - debug << "QAbstractSocket::SocketState(" << int(state) << ")"; + debug << "QAbstractSocket::SocketState(" << int(state) << ')'; break; } return debug; diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 327bfc6..9411130 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -468,7 +468,7 @@ QDebug operator<<(QDebug debug, QLocalSocket::LocalSocketError error) debug << "QLocalSocket::UnknownSocketError"; break; default: - debug << "QLocalSocket::SocketError(" << int(error) << ")"; + debug << "QLocalSocket::SocketError(" << int(error) << ')'; break; } return debug; @@ -490,7 +490,7 @@ QDebug operator<<(QDebug debug, QLocalSocket::LocalSocketState state) debug << "QLocalSocket::ClosingState"; break; default: - debug << "QLocalSocket::SocketState(" << int(state) << ")"; + debug << "QLocalSocket::SocketState(" << int(state) << ')'; break; } return debug; diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index c41e32d..40d86ac 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -153,7 +153,7 @@ static inline QString dump(const QByteArray &) { return QString(); } */ static bool qt_socks5_set_host_address_and_port(const QHostAddress &address, quint16 port, QByteArray *pBuf) { - QSOCKS5_DEBUG << "setting [" << address << ":" << port << "]"; + QSOCKS5_DEBUG << "setting [" << address << ':' << port << ']'; union { quint16 port; @@ -186,7 +186,7 @@ static bool qt_socks5_set_host_address_and_port(const QHostAddress &address, qui */ static bool qt_socks5_set_host_name_and_port(const QString &hostname, quint16 port, QByteArray *pBuf) { - QSOCKS5_DEBUG << "setting [" << hostname << ":" << port << "]"; + QSOCKS5_DEBUG << "setting [" << hostname << ':' << port << ']'; QByteArray encodedHostName = QUrl::toAce(hostname); QByteArray &buf = *pBuf; @@ -265,7 +265,7 @@ static bool qt_socks5_get_host_address_and_port(const QByteArray &buf, QHostAddr } if (ret) { - QSOCKS5_DEBUG << "got [" << address << ":" << port << "]"; + QSOCKS5_DEBUG << "got [" << address << ':' << port << ']'; *pAddress = address; *pPort = port; *pPos = pos; @@ -1124,7 +1124,7 @@ bool QSocks5SocketEngine::connectInternal() bool QSocks5SocketEngine::connectToHost(const QHostAddress &address, quint16 port) { Q_D(QSocks5SocketEngine); - QSOCKS5_DEBUG << "connectToHost" << address << ":" << port; + QSOCKS5_DEBUG << "connectToHost" << address << ':' << port; setPeerAddress(address); setPeerPort(port); @@ -1379,7 +1379,7 @@ bool QSocks5SocketEngine::bind(const QHostAddress &address, quint16 port) //### reset and error return false; } - QSOCKS5_DEBUG << "udp actual address and port" << d->localAddress << ":" << d->localPort; + QSOCKS5_DEBUG << "udp actual address and port" << d->localAddress << ':' << d->localPort; return true; #endif // QT_NO_UDPSOCKET } @@ -1478,7 +1478,7 @@ qint64 QSocks5SocketEngine::bytesAvailable() const qint64 QSocks5SocketEngine::read(char *data, qint64 maxlen) { Q_D(QSocks5SocketEngine); - QSOCKS5_Q_DEBUG << "read( , maxlen = " << maxlen << ")"; + QSOCKS5_Q_DEBUG << "read( , maxlen = " << maxlen << ')'; if (d->mode == QSocks5SocketEnginePrivate::ConnectMode) { if (d->connectData->readBuffer.size() == 0) { if (d->data->controlSocket->state() == QAbstractSocket::UnconnectedState) { @@ -1766,7 +1766,7 @@ void QSocks5SocketEngine::setReadNotificationEnabled(bool enable) { Q_D(QSocks5SocketEngine); - QSOCKS5_Q_DEBUG << "setReadNotificationEnabled(" << enable << ")"; + QSOCKS5_Q_DEBUG << "setReadNotificationEnabled(" << enable << ')'; bool emitSignal = false; if (!d->readNotificationEnabled diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 7b554dc..7ee0f07 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -766,16 +766,16 @@ QDebug operator<<(QDebug debug, const QSslCertificate &certificate) { debug << "QSslCertificate(" << certificate.version() - << "," << certificate.serialNumber() - << "," << certificate.digest().toBase64() - << "," << certificate.issuerInfo(QSslCertificate::Organization) - << "," << certificate.subjectInfo(QSslCertificate::Organization) - << "," << certificate.alternateSubjectNames() + << ',' << certificate.serialNumber() + << ',' << certificate.digest().toBase64() + << ',' << certificate.issuerInfo(QSslCertificate::Organization) + << ',' << certificate.subjectInfo(QSslCertificate::Organization) + << ',' << certificate.alternateSubjectNames() #ifndef QT_NO_TEXTSTREAM - << "," << certificate.effectiveDate() - << "," << certificate.expiryDate() + << ',' << certificate.effectiveDate() + << ',' << certificate.expiryDate() #endif - << ")"; + << ')'; return debug; } QDebug operator<<(QDebug debug, QSslCertificate::SubjectInfo info) diff --git a/src/network/ssl/qsslcipher.cpp b/src/network/ssl/qsslcipher.cpp index 7fec2df..696db1e 100644 --- a/src/network/ssl/qsslcipher.cpp +++ b/src/network/ssl/qsslcipher.cpp @@ -231,7 +231,7 @@ QDebug operator<<(QDebug debug, const QSslCipher &cipher) debug << "QSslCipher(name=" << qPrintable(cipher.name()) << ", bits=" << cipher.usedBits() << ", proto=" << qPrintable(cipher.protocolString()) - << ")"; + << ')'; return debug; } #endif diff --git a/src/network/ssl/qsslkey.cpp b/src/network/ssl/qsslkey.cpp index 8d550c0..6dbdc29 100644 --- a/src/network/ssl/qsslkey.cpp +++ b/src/network/ssl/qsslkey.cpp @@ -460,7 +460,7 @@ QDebug operator<<(QDebug debug, const QSslKey &key) << (key.type() == QSsl::PublicKey ? "PublicKey" : "PrivateKey") << ", " << (key.algorithm() == QSsl::Rsa ? "RSA" : "DSA") << ", " << key.length() - << ")"; + << ')'; return debug; } #endif diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 92054a4..16033b6 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -442,8 +442,8 @@ bool QSslSocket::setSocketDescriptor(int socketDescriptor, SocketState state, Op { Q_D(QSslSocket); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::setSocketDescriptor(" << socketDescriptor << "," - << state << "," << openMode << ")"; + qDebug() << "QSslSocket::setSocketDescriptor(" << socketDescriptor << ',' + << state << ',' << openMode << ')'; #endif if (!d->plainSocket) d->createPlainSocket(openMode); @@ -1608,7 +1608,7 @@ void QSslSocket::connectToHostImplementation(const QString &hostName, quint16 po #ifdef QSSLSOCKET_DEBUG qDebug() << "QSslSocket::connectToHostImplementation(" - << hostName << "," << port << "," << openMode << ")"; + << hostName << ',' << port << ',' << openMode << ')'; #endif if (!d->plainSocket) { #ifdef QSSLSOCKET_DEBUG @@ -1682,7 +1682,7 @@ qint64 QSslSocket::readData(char *data, qint64 maxlen) } while (!d->readBuffer.isEmpty() && readBytes < maxlen); } #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::readData(" << (void *)data << "," << maxlen << ") ==" << readBytes; + qDebug() << "QSslSocket::readData(" << (void *)data << ',' << maxlen << ") ==" << readBytes; #endif return readBytes; } @@ -1694,7 +1694,7 @@ qint64 QSslSocket::writeData(const char *data, qint64 len) { Q_D(QSslSocket); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::writeData(" << (void *)data << "," << len << ")"; + qDebug() << "QSslSocket::writeData(" << (void *)data << ',' << len << ')'; #endif if (d->mode == UnencryptedMode && !d->autoStartHandshake) return d->plainSocket->write(data, len); @@ -1999,7 +1999,7 @@ void QSslSocketPrivate::_q_stateChangedSlot(QAbstractSocket::SocketState state) { Q_Q(QSslSocket); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::_q_stateChangedSlot(" << state << ")"; + qDebug() << "QSslSocket::_q_stateChangedSlot(" << state << ')'; #endif q->setSocketState(state); emit q->stateChanged(state); @@ -2012,7 +2012,7 @@ void QSslSocketPrivate::_q_errorSlot(QAbstractSocket::SocketError error) { Q_Q(QSslSocket); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::_q_errorSlot(" << error << ")"; + qDebug() << "QSslSocket::_q_errorSlot(" << error << ')'; qDebug() << "\tstate =" << q->state(); qDebug() << "\terrorString =" << q->errorString(); #endif @@ -2047,7 +2047,7 @@ void QSslSocketPrivate::_q_bytesWrittenSlot(qint64 written) { Q_Q(QSslSocket); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocket::_q_bytesWrittenSlot(" << written << ")"; + qDebug() << "QSslSocket::_q_bytesWrittenSlot(" << written << ')'; #endif if (mode == QSslSocket::UnencryptedMode) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 32b02c5..4017c4d 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -276,7 +276,7 @@ init_context: if (first) first = false; else - cipherString.append(":"); + cipherString.append(':'); cipherString.append(cipher.name().toLatin1()); } diff --git a/src/opengl/qegl.cpp b/src/opengl/qegl.cpp index c6c258b..f1ae4ed 100644 --- a/src/opengl/qegl.cpp +++ b/src/opengl/qegl.cpp @@ -582,7 +582,7 @@ QString QEglProperties::toString() const if (val != EGL_DONT_CARE) { str += QLatin1String("id="); str += QString::number(val); - str += QLatin1String(" "); + str += QLatin1Char(' '); } #ifdef EGL_RENDERABLE_TYPE @@ -617,11 +617,11 @@ QString QEglProperties::toString() const bufferSize = EGL_DONT_CARE; str += QLatin1String(" rgba="); str += QString::number(red); - str += QLatin1String(","); + str += QLatin1Char(','); str += QString::number(green); - str += QLatin1String(","); + str += QLatin1Char(','); str += QString::number(blue); - str += QLatin1String(","); + str += QLatin1Char(','); str += QString::number(alpha); if (bufferSize != EGL_DONT_CARE) { // Only report buffer size if different than r+g+b+a. @@ -708,7 +708,7 @@ QString QEglProperties::toString() const if (height != EGL_DONT_CARE || width != EGL_DONT_CARE) { addTag(str, QLatin1String(" max-pbuffer-size=")); str += QString::number(width); - str += QLatin1String("x"); + str += QLatin1Char('x'); str += QString::number(height); if (pixels != (width * height)) { addTag(str, QLatin1String(" max-pbuffer-pixels=")); @@ -762,9 +762,9 @@ QString QEglProperties::toString() const if (val == EGL_TRANSPARENT_RGB) { addTag(str, QLatin1String(" transparent-rgb=")); str += QString::number(value(EGL_TRANSPARENT_RED_VALUE)); - str += QLatin1String(","); + str += QLatin1Char(','); str += QString::number(value(EGL_TRANSPARENT_GREEN_VALUE)); - str += QLatin1String(","); + str += QLatin1Char(','); str += QString::number(value(EGL_TRANSPARENT_BLUE_VALUE)); } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 431b488..60039eb 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4365,7 +4365,7 @@ Q_OPENGL_EXPORT const QString qt_gl_library_name() { if (qt_gl_lib_name()->isNull()) { #if defined(Q_WS_X11) || defined(Q_WS_QWS) - return QString(QLatin1String("GL")); + return QLatin1String("GL"); #else // Q_WS_MAC return QLatin1String("/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"); #endif diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 528cc3b..28a50bd 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -433,7 +433,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) if (!d->gpm) return false; } - QString glxExt = QString(QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS))); + QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); if (glxExt.contains(QLatin1String("GLX_SGI_video_sync"))) { if (d->glFormat.swapInterval() == -1) d->glFormat.setSwapInterval(0); @@ -787,7 +787,7 @@ void QGLContext::swapBuffers() const static qt_glXWaitVideoSyncSGI glXWaitVideoSyncSGI = 0; static bool resolved = false; if (!resolved) { - QString glxExt = QString(QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS))); + QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); if (glxExt.contains(QLatin1String("GLX_SGI_video_sync"))) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); @@ -1032,7 +1032,7 @@ void *QGLContext::getProcAddress(const QString &proc) const if (resolved && !glXGetProcAddressARB) return 0; if (!glXGetProcAddressARB) { - QString glxExt = QString(QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS))); + QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); if (glxExt.contains(QLatin1String("GLX_ARB_get_proc_address"))) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index eb3298b..275bbed 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -192,15 +192,15 @@ bool QGLPixmapColorizeFilter::processGL(QPainter *, const QPointF &pos, const QP // generates convolution filter code for arbitrary sized kernel QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const { QByteArray code; - code.append("uniform sampler2D texture;\n"); - code.append("uniform vec2 inv_texture_size;\n"); - code.append("uniform float matrix["); + code.append("uniform sampler2D texture;\n" + "uniform vec2 inv_texture_size;\n" + "uniform float matrix["); code.append(QByteArray::number(m_kernelWidth * m_kernelHeight)); - code.append("];\n"); - code.append("vec2 offset["); + code.append("];\n" + "vec2 offset["); code.append(QByteArray::number(m_kernelWidth*m_kernelHeight)); - code.append("];\n"); - code.append("void main(void) {\n"); + code.append("];\n" + "void main(void) {\n"); for(int y = 0; y < m_kernelHeight; y++) { for(int x = 0; x < m_kernelWidth; x++) { @@ -210,22 +210,21 @@ QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const { code.append(QByteArray::number(x-(int)(m_kernelWidth/2))); code.append(".0, inv_texture_size.y * "); code.append(QByteArray::number((int)(m_kernelHeight/2)-y)); - code.append(".0)"); - code.append(";\n"); + code.append(".0);\n"); } } - code.append(" int i = 0;\n"); - code.append(" vec2 coords = gl_TexCoord[0].st;\n"); - code.append(" vec4 sum = vec4(0.0);\n"); - code.append(" for (i = 0; i < "); + code.append(" int i = 0;\n" + " vec2 coords = gl_TexCoord[0].st;\n" + " vec4 sum = vec4(0.0);\n" + " for (i = 0; i < "); code.append(QByteArray::number(m_kernelWidth * m_kernelHeight)); - code.append("; i++) {\n"); - code.append(" vec4 tmp = texture2D(texture,coords+offset[i]);\n"); - code.append(" sum += matrix[i] * tmp;\n"); - code.append(" }\n"); - code.append(" gl_FragColor = sum;\n"); - code.append("}"); + code.append("; i++) {\n" + " vec4 tmp = texture2D(texture,coords+offset[i]);\n" + " sum += matrix[i] * tmp;\n" + " }\n" + " gl_FragColor = sum;\n" + "}"); return code; } diff --git a/src/opengl/util/generator.cpp b/src/opengl/util/generator.cpp index de2450d..dac5a2d 100644 --- a/src/opengl/util/generator.cpp +++ b/src/opengl/util/generator.cpp @@ -116,7 +116,7 @@ QList<QStringPair> readConf(const QString &confFile) lineStream >> enumerator; if (lineStream.atEnd()) { - qDebug() << "Error in file" << confFile << "(" << enumerator << ")"; + qDebug() << "Error in file" << confFile << '(' << enumerator << ')'; exit(0); } diff --git a/src/plugins/accessible/widgets/rangecontrols.cpp b/src/plugins/accessible/widgets/rangecontrols.cpp index 9297d6e..6d8c184 100644 --- a/src/plugins/accessible/widgets/rangecontrols.cpp +++ b/src/plugins/accessible/widgets/rangecontrols.cpp @@ -799,7 +799,7 @@ int QAccessibleSlider::defaultAction(int /*child*/) const /*! \internal */ QString QAccessibleSlider::actionText(int /*action*/, Text /*t*/, int /*child*/) const { - return QString(QLatin1String("")); + return QLatin1String(""); } QAccessibleAbstractSlider::QAccessibleAbstractSlider(QWidget *w, Role r) diff --git a/src/plugins/gfxdrivers/hybrid/hybridscreen.cpp b/src/plugins/gfxdrivers/hybrid/hybridscreen.cpp index 3a40b4c..da61a22 100644 --- a/src/plugins/gfxdrivers/hybrid/hybridscreen.cpp +++ b/src/plugins/gfxdrivers/hybrid/hybridscreen.cpp @@ -103,11 +103,11 @@ bool HybridScreen::connect(const QString &displaySpec) { QString dspec = displaySpec; if (dspec.startsWith(QLatin1String("hybrid:"), Qt::CaseInsensitive)) - dspec = dspec.mid(QString(QLatin1String("hybrid:")).size()); + dspec = dspec.mid(QString::fromLatin1("hybrid:").size()); else if (dspec.compare(QLatin1String("hybrid"), Qt::CaseInsensitive) == 0) dspec = QString(); - const QString displayIdSpec = QString(QLatin1String(" :%1")).arg(displayId); + const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId); if (dspec.endsWith(displayIdSpec)) dspec = dspec.left(dspec.size() - displayIdSpec.size()); diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp index b7f03ba..8be3672 100644 --- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp +++ b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp @@ -2100,11 +2100,11 @@ bool QVNCScreen::connect(const QString &displaySpec) { QString dspec = displaySpec; if (dspec.startsWith(QLatin1String("vnc:"), Qt::CaseInsensitive)) - dspec = dspec.mid(QString(QLatin1String("vnc:")).size()); + dspec = dspec.mid(QString::fromLatin1("vnc:").size()); else if (dspec.compare(QLatin1String("vnc"), Qt::CaseInsensitive) == 0) dspec = QString(); - const QString displayIdSpec = QString(QLatin1String(" :%1")).arg(displayId); + const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId); if (dspec.endsWith(displayIdSpec)) dspec = dspec.left(dspec.size() - displayIdSpec.size()); diff --git a/src/qt3support/dialogs/q3filedialog.cpp b/src/qt3support/dialogs/q3filedialog.cpp index b9f8196..e41941b 100644 --- a/src/qt3support/dialogs/q3filedialog.cpp +++ b/src/qt3support/dialogs/q3filedialog.cpp @@ -3879,7 +3879,7 @@ void Q3FileDialog::detailViewSelectionChanged() d->moreFiles->setSelected(f->i, i->isSelected()); } if (i->isSelected() && !((Q3FileDialogPrivate::File *)i)->info.isDir()) - str += QString(QLatin1String("\"%1\" ")).arg(i->text(0)); + str += QString::fromLatin1("\"%1\" ").arg(i->text(0)); i = i->nextSibling(); } d->moreFiles->blockSignals(false); @@ -3931,7 +3931,7 @@ void Q3FileDialog::listBoxSelectionChanged() } if (d->moreFiles->isSelected(i) && !((Q3FileDialogPrivate::File*)(mcitem)->i)->info.isDir()) { - str += QString(QLatin1String("\"%1\" ")).arg(i->text()); + str += QString::fromLatin1("\"%1\" ").arg(i->text()); if (j == 0) j = i; } @@ -5757,8 +5757,8 @@ void Q3FileDialog::insertEntry(const Q3ValueList<QUrlInfo> &lst, Q3NetworkOperat if (!bShowHiddenFiles && inf.name() != QLatin1String("..")) { if (d->url.isLocalFile()) { QString file = d->url.path(); - if (!file.endsWith(QLatin1String("/"))) - file.append(QLatin1String("/")); + if (!file.endsWith(QLatin1Char('/'))) + file.append(QLatin1Char('/')); file += inf.name(); QT_WA({ if (GetFileAttributesW((TCHAR*)file.ucs2()) & FILE_ATTRIBUTE_HIDDEN) diff --git a/src/qt3support/dialogs/q3filedialog_mac.cpp b/src/qt3support/dialogs/q3filedialog_mac.cpp index f1c749ec..18bebf1 100644 --- a/src/qt3support/dialogs/q3filedialog_mac.cpp +++ b/src/qt3support/dialogs/q3filedialog_mac.cpp @@ -554,7 +554,7 @@ QString Q3FileDialog::macGetSaveFileName(const QString &start, const QString &fi retstr = QString::fromUtf8((const char *)str_buffer); //now filename CFStringGetCString(ret.saveFileName, (char *)str_buffer, 1024, kCFStringEncodingUTF8); - retstr += QLatin1String("/") + QString::fromUtf8((const char *)str_buffer); + retstr += QLatin1Char('/') + QString::fromUtf8((const char *)str_buffer); } NavDisposeReply(&ret); if(selectedFilter) diff --git a/src/qt3support/dialogs/q3filedialog_win.cpp b/src/qt3support/dialogs/q3filedialog_win.cpp index 1be797a..a1c98f3 100644 --- a/src/qt3support/dialogs/q3filedialog_win.cpp +++ b/src/qt3support/dialogs/q3filedialog_win.cpp @@ -737,7 +737,7 @@ QString Q3FileDialog::winGetExistingDirectory(const QString& initialDirectory, QDir::setCurrent(currentDir); if (!result.isEmpty()) - result.replace(QLatin1String("\\"), QLatin1String("/")); + result.replace(QLatin1Char('\\'), QLatin1Char('/')); return result; #else return QString(); diff --git a/src/qt3support/itemviews/q3iconview.cpp b/src/qt3support/itemviews/q3iconview.cpp index d1a9c1e..a5664de 100644 --- a/src/qt3support/itemviews/q3iconview.cpp +++ b/src/qt3support/itemviews/q3iconview.cpp @@ -614,7 +614,7 @@ QByteArray Q3IconDrag::encodedData(const char* mime) const (*it).item.textRect().x()).arg((*it).item.textRect().y()). arg((*it).item.textRect().width()).arg( (*it).item.textRect().height()); - k += QString(QLatin1String((*it).data.data())) + QLatin1String("$@@$"); + k += QString::fromLatin1((*it).data.data()) + QLatin1String("$@@$"); s += k; } @@ -1820,8 +1820,8 @@ void Q3IconViewItem::calcRect(const QString &text_) tw = r.width(); th = r.height(); - if (tw < view->d->fm->width(QLatin1String("X"))) - tw = view->d->fm->width(QLatin1String("X")); + if (tw < view->d->fm->width(QLatin1Char('X'))) + tw = view->d->fm->width(QLatin1Char('X')); itemTextRect.setWidth(tw); itemTextRect.setHeight(th); diff --git a/src/qt3support/network/q3dns.cpp b/src/qt3support/network/q3dns.cpp index c53f2ff..3ca3977 100644 --- a/src/qt3support/network/q3dns.cpp +++ b/src/qt3support/network/q3dns.cpp @@ -1738,7 +1738,7 @@ void Q3Dns::setLabel( const QString & label ) const char * dom; while( (dom=it.current()) != 0 ) { ++it; - n.append( l.lower() + QLatin1String(".") + QLatin1String(dom) ); + n.append( l.lower() + QLatin1Char('.') + QLatin1String(dom) ); } } n.append( l.lower() ); @@ -1902,8 +1902,8 @@ QString Q3Dns::toInAddrArpaDomain( const QHostAddress &address ) s = QLatin1String("ip6.arpa"); uint b = 0; while( b < 16 ) { - s = QString::number( i.c[b]%16, 16 ) + QLatin1String(".") + - QString::number( i.c[b]/16, 16 ) + QLatin1String(".") + s; + s = QString::number( i.c[b]%16, 16 ) + QLatin1Char('.') + + QString::number( i.c[b]/16, 16 ) + QLatin1Char('.') + s; b++; } } @@ -2347,7 +2347,7 @@ void Q3Dns::doResInit() nameServer += QLatin1String(dnsServer->IpAddress.String); dnsServer = dnsServer->Next; if ( dnsServer != 0 ) - nameServer += QLatin1String(" "); + nameServer += QLatin1Char(' '); } searchList = QLatin1String(""); separator = ' '; @@ -2360,12 +2360,12 @@ void Q3Dns::doResInit() } if ( !gotNetworkParams ) { if ( getDnsParamsFromRegistry( - QString( QLatin1String("System\\CurrentControlSet\\Services\\Tcpip\\Parameters") ), + QLatin1String("System\\CurrentControlSet\\Services\\Tcpip\\Parameters"), &domainName, &nameServer, &searchList )) { // for NT separator = ' '; } else if ( getDnsParamsFromRegistry( - QString( QLatin1String("System\\CurrentControlSet\\Services\\VxD\\MSTCP") ), + QLatin1String("System\\CurrentControlSet\\Services\\VxD\\MSTCP"), &domainName, &nameServer, &searchList )) { // for Windows 98 separator = ','; @@ -2395,7 +2395,7 @@ void Q3Dns::doResInit() } while( first < (int)nameServer.length() ); } - searchList = searchList + QLatin1String(" ") + domainName; + searchList += QLatin1Char(' ') + domainName; searchList = searchList.simplifyWhiteSpace().lower(); first = 0; do { @@ -2488,7 +2488,7 @@ void Q3Dns::doResInit() while ( !stream.atEnd() ) { line = stream.readLine(); QStringList list = QStringList::split( QLatin1String(" "), line ); - if( line.startsWith( QLatin1String("#") ) || list.size() < 2 ) + if( line.startsWith( QLatin1Char('#') ) || list.size() < 2 ) continue; const QString type = list[0].lower(); diff --git a/src/qt3support/network/q3ftp.cpp b/src/qt3support/network/q3ftp.cpp index 5ab84cc..44c1f5c 100644 --- a/src/qt3support/network/q3ftp.cpp +++ b/src/qt3support/network/q3ftp.cpp @@ -485,7 +485,7 @@ bool Q3FtpDTP::parseDir( const QString &buffer, const QString &userName, QUrlInf dateStr += lst[ 6 ]; dateStr += QLatin1Char(' '); - if ( lst[ 7 ].contains( QLatin1String(":") ) ) { + if ( lst[ 7 ].contains( QLatin1Char(':') ) ) { time = QTime( lst[ 7 ].left( 2 ).toInt(), lst[ 7 ].right( 2 ).toInt() ); dateStr += QString::number( QDate::currentDate().year() ); } else { @@ -495,7 +495,7 @@ bool Q3FtpDTP::parseDir( const QString &buffer, const QString &userName, QUrlInf QDate date = QDate::fromString( dateStr ); info->setLastModified( QDateTime( date, time ) ); - if ( lst[ 7 ].contains( QLatin1String(":") ) ) { + if ( lst[ 7 ].contains( QLatin1Char(':') ) ) { const int futureTolerance = 600; if( info->lastModified().secsTo( QDateTime::currentDateTime() ) < -futureTolerance ) { QDateTime dt = info->lastModified(); @@ -512,7 +512,7 @@ bool Q3FtpDTP::parseDir( const QString &buffer, const QString &userName, QUrlInf else { QString n; for ( uint i = 8; i < (uint) lst.count(); ++i ) - n += lst[ i ] + QLatin1String(" "); + n += lst[ i ] + QLatin1Char(' '); n = n.stripWhiteSpace(); info->setName( n ); } @@ -897,7 +897,7 @@ bool Q3FtpPI::processReply() // ### error handling } else { QStringList lst = addrPortPattern.capturedTexts(); - QString host = lst[1] + QLatin1String(".") + lst[2] + QLatin1String(".") + lst[3] + QLatin1String(".") + lst[4]; + QString host = lst[1] + QLatin1Char('.') + lst[2] + QLatin1Char('.') + lst[3] + QLatin1Char('.') + lst[4]; Q_UINT16 port = ( lst[5].toUInt() << 8 ) + lst[6].toUInt(); waitForDtpToConnect = true; dtp.connectToHost( host, port ); @@ -1435,8 +1435,8 @@ int Q3Ftp::connectToHost( const QString &host, Q_UINT16 port ) int Q3Ftp::login( const QString &user, const QString &password ) { QStringList cmds; - cmds << ( QString(QLatin1String("USER ")) + ( user.isNull() ? QString(QLatin1String("anonymous")) : user ) + QLatin1String("\r\n") ); - cmds << ( QString(QLatin1String("PASS ")) + ( password.isNull() ? QString(QLatin1String("anonymous@")) : password ) + QLatin1String("\r\n") ); + cmds << ( QString::fromLatin1("USER ") + ( user.isNull() ? QString::fromLatin1("anonymous") : user ) + QLatin1String("\r\n") ); + cmds << ( QString::fromLatin1("PASS ") + ( password.isNull() ? QString::fromLatin1("anonymous@") : password ) + QLatin1String("\r\n") ); return addCommand( new Q3FtpCommand( Login, cmds ) ); } @@ -2095,7 +2095,7 @@ void Q3Ftp::operationListChildren( Q3NetworkOperation *op ) { op->setState( StInProgress ); - cd( ( url()->path().isEmpty() ? QString( QLatin1String("/") ) : url()->path() ) ); + cd( ( url()->path().isEmpty() ? QString::fromLatin1("/") : url()->path() ) ); list(); emit start( op ); } @@ -2115,7 +2115,7 @@ void Q3Ftp::operationRemove( Q3NetworkOperation *op ) { op->setState( StInProgress ); - cd( ( url()->path().isEmpty() ? QString( QLatin1String("/") ) : url()->path() ) ); + cd( ( url()->path().isEmpty() ? QString::fromLatin1("/") : url()->path() ) ); remove( Q3Url( op->arg( 0 ) ).path() ); } @@ -2125,7 +2125,7 @@ void Q3Ftp::operationRename( Q3NetworkOperation *op ) { op->setState( StInProgress ); - cd( ( url()->path().isEmpty() ? QString( QLatin1String("/") ) : url()->path() ) ); + cd( ( url()->path().isEmpty() ? QString::fromLatin1("/") : url()->path() ) ); rename( op->arg( 0 ), op->arg( 1 )); } @@ -2179,8 +2179,8 @@ bool Q3Ftp::checkConnection( Q3NetworkOperation *op ) connectToHost( url()->host(), url()->port() != -1 ? url()->port() : 21 ); break; } - QString user = url()->user().isEmpty() ? QString( QLatin1String("anonymous") ) : url()->user(); - QString pass = url()->password().isEmpty() ? QString( QLatin1String("anonymous@") ) : url()->password(); + QString user = url()->user().isEmpty() ? QString::fromLatin1("anonymous") : url()->user(); + QString pass = url()->password().isEmpty() ? QString::fromLatin1("anonymous@") : url()->password(); login( user, pass ); } diff --git a/src/qt3support/network/q3http.cpp b/src/qt3support/network/q3http.cpp index 591b381..aabf4a3 100644 --- a/src/qt3support/network/q3http.cpp +++ b/src/qt3support/network/q3http.cpp @@ -468,7 +468,7 @@ bool Q3HttpHeader::parse( const QString& str ) if ( !(*it).isEmpty() ) { if ( (*it)[0].isSpace() ) { if ( !lines.isEmpty() ) { - lines.last() += QLatin1String(" "); + lines.last() += QLatin1Char(' '); lines.last() += (*it).stripWhiteSpace(); } } else { @@ -562,7 +562,7 @@ void Q3HttpHeader::removeValue( const QString& key ) */ bool Q3HttpHeader::parseLine( const QString& line, int ) { - int i = line.find( QLatin1String(":") ); + int i = line.find( QLatin1Char(':') ); if ( i == -1 ) return false; @@ -647,7 +647,7 @@ QString Q3HttpHeader::contentType() const if ( type.isEmpty() ) return QString(); - int pos = type.find( QLatin1String(";") ); + int pos = type.find( QLatin1Char(';') ); if ( pos == -1 ) return type; @@ -2210,7 +2210,7 @@ void Q3Http::clientReply( const Q3HttpResponseHeader &rep ) if ( rep.statusCode() >= 400 && rep.statusCode() < 600 ) { op->setState( StFailed ); op->setProtocolDetail( - QString(QLatin1String("%1 %2")).arg(rep.statusCode()).arg(rep.reasonPhrase()) + QString::fromLatin1("%1 %2").arg(rep.statusCode()).arg(rep.reasonPhrase()) ); switch ( rep.statusCode() ) { case 401: diff --git a/src/qt3support/network/q3url.cpp b/src/qt3support/network/q3url.cpp index fc2fdb2..68753b6 100644 --- a/src/qt3support/network/q3url.cpp +++ b/src/qt3support/network/q3url.cpp @@ -211,8 +211,8 @@ Q3Url::Q3Url( const Q3Url& url ) bool Q3Url::isRelativeUrl( const QString &url ) { - int colon = url.find( QLatin1String(":") ); - int slash = url.find( QLatin1String("/") ); + int colon = url.find( QLatin1Char(':') ); + int slash = url.find( QLatin1Char('/') ); return ( slash != 0 && ( colon == -1 || ( slash != -1 && colon > slash ) ) ); } @@ -280,8 +280,8 @@ Q3Url::Q3Url( const Q3Url& url, const QString& relUrl, bool checkSlash ) if ( !d->host.isEmpty() && !d->user.isEmpty() && !d->pass.isEmpty() ) p = QLatin1String("/"); } - if ( !p.isEmpty() && p.right(1)!=QLatin1String("/") ) - p += QLatin1String("/"); + if ( !p.isEmpty() && !p.endsWith(QLatin1Char('/')) ) + p += QLatin1Char('/'); p += rel; d->path = p; d->cleanPathDirty = true; @@ -678,7 +678,7 @@ bool Q3Url::parse( const QString& url ) ++cs; while ( url_[ cs ] == QLatin1Char('/') ) ++cs; - int slash = url_.find( QLatin1String("/"), cs ); + int slash = url_.find( QLatin1Char('/'), cs ); if ( slash == -1 ) slash = url_.length() - 1; QString tmp = url_.mid( cs, slash - cs + 1 ); @@ -686,7 +686,7 @@ bool Q3Url::parse( const QString& url ) if ( !tmp.isEmpty() ) { // if this part exists // look for the @ in this part - int at = tmp.find( QLatin1String("@") ); + int at = tmp.find( QLatin1Char('@') ); if ( at != -1 ) at += cs; // we have no @, which means host[:port], so directly @@ -793,7 +793,7 @@ bool Q3Url::parse( const QString& url ) // hack for windows if ( d->path.length() == 2 && d->path[ 1 ] == QLatin1Char(':') ) - d->path += QLatin1String("/"); + d->path += QLatin1Char('/'); // #### do some corrections, should be done nicer too if ( !d->pass.isEmpty() ) { @@ -808,7 +808,7 @@ bool Q3Url::parse( const QString& url ) if ( d->path[ 0 ] == QLatin1Char('@') || d->path[ 0 ] == QLatin1Char(':') ) d->path.remove( (uint)0, 1 ); if ( d->path[ 0 ] != QLatin1Char('/') && !relPath && d->path[ 1 ] != QLatin1Char(':') ) - d->path.prepend( QLatin1String("/") ); + d->path.prepend( QLatin1Char('/') ); } if ( !d->refEncoded.isEmpty() && d->refEncoded[ 0 ] == QLatin1Char('#') ) d->refEncoded.remove( (uint)0, 1 ); @@ -820,9 +820,9 @@ bool Q3Url::parse( const QString& url ) #if defined(Q_OS_WIN32) // hack for windows file://machine/path syntax if ( d->protocol == QLatin1String("file") ) { - if ( url.left( 7 ) == QLatin1String("file://") && + if ( url.startsWith(QLatin1String("file://")) && d->path.length() > 1 && d->path[ 1 ] != QLatin1Char(':') ) - d->path.prepend( QLatin1String("/") ); + d->path.prepend( QLatin1Char('/') ); } #endif @@ -942,7 +942,7 @@ void Q3Url::setFileName( const QString& name ) p += fn; if ( !d->queryEncoded.isEmpty() ) - p += QLatin1String("?") + d->queryEncoded; + p += QLatin1Char('?') + d->queryEncoded; setEncodedPathAndQuery( p ); } @@ -961,7 +961,7 @@ QString Q3Url::encodedPathAndQuery() encode( p ); if ( !d->queryEncoded.isEmpty() ) { - p += QLatin1String("?"); + p += QLatin1Char('?'); p += d->queryEncoded; } @@ -1011,7 +1011,7 @@ QString Q3Url::path( bool correct ) const } else if ( isLocalFile() ) { #if defined(Q_OS_WIN32) // hack for stuff like \\machine\path and //machine/path on windows - if ( ( d->path.left( 1 ) == QLatin1String("/") || d->path.left( 1 ) == QLatin1String("\\") ) && + if ( ( d->path.startsWith(QLatin1Char('/')) || d->path.startsWith(QLatin1Char('\\')) ) && d->path.length() > 1 ) { d->cleanPath = d->path; bool share = (d->cleanPath[0] == QLatin1Char('\\') && d->cleanPath[1] == QLatin1Char('\\')) || @@ -1021,7 +1021,7 @@ QString Q3Url::path( bool correct ) const if ( share ) { check = false; while (d->cleanPath.at(0) != QLatin1Char('/') || d->cleanPath.at(1) != QLatin1Char('/')) - d->cleanPath.prepend(QLatin1String("/")); + d->cleanPath.prepend(QLatin1Char('/')); } } #endif @@ -1036,7 +1036,7 @@ QString Q3Url::path( bool correct ) const dir = QDir::cleanDirPath( canPath ); else dir = QDir::cleanDirPath( QDir( d->path ).absPath() ); - dir += QLatin1String("/"); + dir += QLatin1Char('/'); if ( dir == QLatin1String("//") ) d->cleanPath = QLatin1String("/"); else @@ -1046,14 +1046,13 @@ QString Q3Url::path( bool correct ) const QDir::cleanDirPath( (qt_resolve_symlinks ? fi.dir().canonicalPath() : fi.dir().absPath()) ); - d->cleanPath = p + QLatin1String("/") + fi.fileName(); + d->cleanPath = p + QLatin1Char('/') + fi.fileName(); } } } else { - if ( d->path != QLatin1String("/") && d->path[ (int)d->path.length() - 1 ] == QLatin1Char('/') ) - d->cleanPath = QDir::cleanDirPath( d->path ) + QLatin1String("/"); - else d->cleanPath = QDir::cleanDirPath( d->path ); + if ( d->path.length() > 1 && d->path.endsWith(QLatin1Char('/')) ) + d->cleanPath += QLatin1Char('/'); } if ( check ) @@ -1084,9 +1083,9 @@ bool Q3Url::isLocalFile() const QString Q3Url::fileName() const { - if ( d->path.isEmpty() || d->path.endsWith( QLatin1String("/") ) + if ( d->path.isEmpty() || d->path.endsWith( QLatin1Char('/') ) #ifdef Q_WS_WIN - || d->path.endsWith( QLatin1String("\\") ) + || d->path.endsWith( QLatin1Char('\\') ) #endif ) return QString(); @@ -1110,12 +1109,12 @@ void Q3Url::addPath( const QString& pa ) if ( path().isEmpty() ) { if ( p[ 0 ] != QLatin1Char( '/' ) ) - d->path = QLatin1String("/") + p; + d->path = QLatin1Char('/') + p; else d->path = p; } else { if ( p[ 0 ] != QLatin1Char( '/' ) && d->path[ (int)d->path.length() - 1 ] != QLatin1Char('/') ) - d->path += QLatin1String("/") + p; + d->path += QLatin1Char('/') + p; else d->path += p; } @@ -1250,11 +1249,11 @@ QString Q3Url::toString( bool encodedPath, bool forcePrependProtocol ) const if ( isLocalFile() ) { if ( forcePrependProtocol ) - res = d->protocol + QLatin1String(":") + p; + res = d->protocol + QLatin1Char(':') + p; else res = p; } else if ( d->protocol == QLatin1String("mailto") ) { - res = d->protocol + QLatin1String(":") + p; + res = d->protocol + QLatin1Char(':') + p; } else { res = d->protocol + QLatin1String("://"); if ( !d->user.isEmpty() || !d->pass.isEmpty() ) { @@ -1267,24 +1266,24 @@ QString Q3Url::toString( bool encodedPath, bool forcePrependProtocol ) const if ( !d->pass.isEmpty() ) { tmp = d->pass; encode( tmp ); - res += QLatin1String(":") + tmp; + res += QLatin1Char(':') + tmp; } - res += QLatin1String("@"); + res += QLatin1Char('@'); } res += d->host; if ( d->port != -1 ) - res += QLatin1String(":") + QString( QLatin1String("%1") ).arg( d->port ); + res += QLatin1Char(':') + QString::number( d->port ); if ( !p.isEmpty() ) { if ( !d->host.isEmpty() && p[0]!= QLatin1Char( '/' ) ) - res += QLatin1String("/"); + res += QLatin1Char('/'); res += p; } } if ( !d->refEncoded.isEmpty() ) - res += QLatin1String("#") + d->refEncoded; + res += QLatin1Char('#') + d->refEncoded; if ( !d->queryEncoded.isEmpty() ) - res += QLatin1String("?") + d->queryEncoded; + res += QLatin1Char('?') + d->queryEncoded; return res; } diff --git a/src/qt3support/network/q3urloperator.cpp b/src/qt3support/network/q3urloperator.cpp index b415e12..6afd8ab 100644 --- a/src/qt3support/network/q3urloperator.cpp +++ b/src/qt3support/network/q3urloperator.cpp @@ -579,7 +579,7 @@ Q3PtrList<Q3NetworkOperation> Q3UrlOperator::copy( const QString &from, const QS if (frm == to + file) return ops; - file.prepend( QLatin1String("/") ); + file.prepend( QLatin1Char('/') ); // uFrom and uTo are deleted when the Q3NetworkProtocol deletes itself via // autodelete diff --git a/src/qt3support/other/q3dragobject.cpp b/src/qt3support/other/q3dragobject.cpp index 50b75a4..89ffe24 100644 --- a/src/qt3support/other/q3dragobject.cpp +++ b/src/qt3support/other/q3dragobject.cpp @@ -93,7 +93,7 @@ public: Q3TextDragPrivate() { setSubType(QLatin1String("plain")); } void setSubType(const QString & st) { subtype = st; - fmt = QString(QLatin1String("text/")).toLatin1() + subtype.toLatin1(); + fmt = "text/" + subtype.toLatin1(); } QString txt; @@ -1297,7 +1297,7 @@ QByteArray Q3UriDrag::localFileToUri(const QString& filename) r.prepend(QString::fromLatin1(hostname)); } #endif - return unicodeUriToUri(QString(QLatin1String("file://") + r)); + return unicodeUriToUri(QLatin1String("file://") + r); } /*! @@ -1352,7 +1352,7 @@ QString Q3UriDrag::uriToLocalFile(const char* uri) return file; if (0==qstrnicmp(uri,"file:/",6)) // It is a local file uri uri += 6; - else if (QString(QLatin1String(uri)).indexOf(QLatin1String(":/")) != -1) // It is a different scheme uri + else if (QString::fromLatin1(uri).indexOf(QLatin1String(":/")) != -1) // It is a different scheme uri return file; bool local = uri[0] != '/' || (uri[0] != '\0' && uri[1] == '/'); diff --git a/src/qt3support/other/q3process.cpp b/src/qt3support/other/q3process.cpp index 6eac812..9689de9 100644 --- a/src/qt3support/other/q3process.cpp +++ b/src/qt3support/other/q3process.cpp @@ -483,7 +483,7 @@ QString Q3Process::readLineStdout() return QString(); if ( !buf->scanNewline( &a ) ) - return QString( QLatin1String(buf->readAll()) ); + return QLatin1String(buf->readAll()); } uint size = a.size(); diff --git a/src/qt3support/other/q3process_unix.cpp b/src/qt3support/other/q3process_unix.cpp index 098c581..2492bf2 100644 --- a/src/qt3support/other/q3process_unix.cpp +++ b/src/qt3support/other/q3process_unix.cpp @@ -828,7 +828,7 @@ bool Q3Process::start( QStringList *env ) #ifndef QT_NO_DIR QFileInfo fileInfo( dir, command ); #else - QFileInfo fileInfo( dir + "/" + command ); + QFileInfo fileInfo( dir + QLatin1Char('/') + command ); #endif if ( fileInfo.isExecutable() ) { #if defined(Q_OS_MACX) diff --git a/src/qt3support/other/q3process_win.cpp b/src/qt3support/other/q3process_win.cpp index 3c862ee..7dc28cb 100644 --- a/src/qt3support/other/q3process_win.cpp +++ b/src/qt3support/other/q3process_win.cpp @@ -285,7 +285,7 @@ bool Q3Process::start( QStringList *env ) for ( ; it != _arguments.end(); ++it ) { QString tmp = *it; // escape a single " because the arguments will be parsed - tmp.replace( QLatin1String("\""), QLatin1String("\\\"") ); + tmp.replace( QLatin1Char('\"'), QLatin1String("\\\"") ); if ( tmp.isEmpty() || tmp.contains( QLatin1Char(' ') ) || tmp.contains( QLatin1Char('\t') ) ) { // The argument must not end with a \ since this would be interpreted // as escaping the quote -- rather put the \ behind the quote: e.g. @@ -294,9 +294,9 @@ bool Q3Process::start( QStringList *env ) int i = tmp.length(); while ( i>0 && tmp.at( i-1 ) == QLatin1Char('\\') ) { --i; - endQuote += QLatin1String("\\"); + endQuote += QLatin1Char('\\'); } - args += QString( QLatin1String(" \"") ) + tmp.left( i ) + endQuote; + args += QLatin1String(" \"") + tmp.left( i ) + endQuote; } else { args += QLatin1Char(' ') + tmp; } @@ -330,7 +330,7 @@ bool Q3Process::start( QStringList *env ) // add PATH if necessary (for DLL loading) QByteArray path = qgetenv( "PATH" ); if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) { - QString tmp = QString( QLatin1String("PATH=%1") ).arg(QString::fromLatin1(path.constData())); + QString tmp = QString::fromLatin1("PATH=%1").arg(QLatin1String(path.constData())); uint tmpSize = sizeof(TCHAR) * (tmp.length()+1); envlist.resize( envlist.size() + tmpSize ); memcpy( envlist.data()+pos, tmp.ucs2(), tmpSize ); @@ -378,7 +378,7 @@ bool Q3Process::start( QStringList *env ) // add PATH if necessary (for DLL loading) QByteArray path = qgetenv( "PATH" ); if ( env->grep( QRegExp(QLatin1String("^PATH="),FALSE) ).empty() && !path.isNull() ) { - Q3CString tmp = QString( QLatin1String("PATH=%1") ).arg(QString::fromLatin1(path.constData())).local8Bit(); + Q3CString tmp = QString::fromLatin1("PATH=%1").arg(QString::fromLatin1(path.constData())).local8Bit(); uint tmpSize = tmp.length() + 1; envlist.resize( envlist.size() + tmpSize ); memcpy( envlist.data()+pos, tmp.data(), tmpSize ); diff --git a/src/qt3support/painting/q3paintengine_svg.cpp b/src/qt3support/painting/q3paintengine_svg.cpp index 95528e8..22e0d49 100644 --- a/src/qt3support/painting/q3paintengine_svg.cpp +++ b/src/qt3support/painting/q3paintengine_svg.cpp @@ -263,7 +263,7 @@ void Q3SVGPaintEngine::updateClipPath(const QPainterPath &path, Qt::ClipOperatio QDomElement e; d->currentClip++; e = d->doc.createElement(QLatin1String("clipPath")); - e.setAttribute(QLatin1String("id"), QString(QLatin1String("clip%1")).arg(d->currentClip)); + e.setAttribute(QLatin1String("id"), QString::fromLatin1("clip%1").arg(d->currentClip)); QDomElement path_element = d->doc.createElement(QLatin1String("path")); path_element.setAttribute(QLatin1String("d"), qt_svg_compose_path(path)); @@ -509,14 +509,14 @@ bool Q3SVGPaintEngine::save(const QString &fileName) int icount = 0; ImageList::Iterator iit = d->images.begin(); for (; iit != d->images.end(); ++iit) { - QString href = QString(QLatin1String("%1_%2.png")).arg(svgName).arg(icount); + QString href = QString::fromLatin1("%1_%2.png").arg(svgName).arg(icount); (*iit).image.save(href, "PNG"); (*iit).element.setAttribute(QLatin1String("xlink:href"), href); icount++; } PixmapList::Iterator pit = d->pixmaps.begin(); for (; pit != d->pixmaps.end(); ++pit) { - QString href = QString(QLatin1String("%1_%2.png")).arg(svgName).arg(icount); + QString href = QString::fromLatin1("%1_%2.png").arg(svgName).arg(icount); (*pit).pixmap.save(href, "PNG"); (*pit).element.setAttribute(QLatin1String("xlink:href"), href); icount++; @@ -592,7 +592,7 @@ void Q3SVGPaintEnginePrivate::appendChild(QDomElement &e, QPicturePrivate::Paint if (c == QPicturePrivate::PdcSetClipRegion || c == QPicturePrivate::PdcSetClipPath) { QDomElement ne; ne = doc.createElement(QLatin1String("g")); - ne.setAttribute(QLatin1String("style"), QString(QLatin1String("clip-path:url(#clip%1)")).arg(currentClip)); + ne.setAttribute(QLatin1String("style"), QString::fromLatin1("clip-path:url(#clip%1)").arg(currentClip)); if (dirtyTransform) { applyTransform(&ne); dirtyTransform = false; @@ -621,12 +621,12 @@ void Q3SVGPaintEnginePrivate::applyStyle(QDomElement *e, QPicturePrivate::PaintC if (c == QPicturePrivate::PdcDrawText2 || c == QPicturePrivate::PdcDrawText2Formatted) { // QPainter has a reversed understanding of pen/stroke vs. // brush/fill for text - s += QString(QLatin1String("fill:rgb(%1,%2,%3);")).arg(pcol.red()).arg(pcol.green()).arg(pcol.blue()); - s += QString(QLatin1String("stroke-width:0;")); + s += QString::fromLatin1("fill:rgb(%1,%2,%3);").arg(pcol.red()).arg(pcol.green()).arg(pcol.blue()); + s += QLatin1String("stroke-width:0;"); QFont f = cfont; QFontInfo fi(f); - s += QString(QLatin1String("font-size:%1;")).arg(fi.pointSize()); - s += QString(QLatin1String("font-style:%1;")).arg(f.italic() ? QLatin1String("italic") : QLatin1String("normal")); + s += QString::fromLatin1("font-size:%1;").arg(fi.pointSize()); + s += QString::fromLatin1("font-style:%1;").arg(f.italic() ? QLatin1String("italic") : QLatin1String("normal")); // not a very scientific distribution QString fw; if (f.weight() <= QFont::Light) @@ -641,32 +641,32 @@ void Q3SVGPaintEnginePrivate::applyStyle(QDomElement *e, QPicturePrivate::PaintC fw = QLatin1String("800"); else fw = QLatin1String("900"); - s += QString(QLatin1String("font-weight:%1;")).arg(fw); - s += QString(QLatin1String("font-family:%1;")).arg(f.family()); + s += QString::fromLatin1("font-weight:%1;").arg(fw); + s += QString::fromLatin1("font-family:%1;").arg(f.family()); } else { - s += QString(QLatin1String("stroke:rgb(%1,%2,%3);")).arg(pcol.red()).arg(pcol.green()).arg(pcol.blue()); + s += QString::fromLatin1("stroke:rgb(%1,%2,%3);").arg(pcol.red()).arg(pcol.green()).arg(pcol.blue()); if (pcol.alpha() != 255) - s += QString(QLatin1String("stroke-opacity:%1;")).arg(pcol.alpha()/255.0); + s += QString::fromLatin1("stroke-opacity:%1;").arg(pcol.alpha()/255.0); if (bcol.alpha() != 255) - s += QString(QLatin1String("fill-opacity:%1;")).arg(bcol.alpha()/255.0); + s += QString::fromLatin1("fill-opacity:%1;").arg(bcol.alpha()/255.0); double pw = cpen.width(); if (pw == 0 && cpen.style() != Qt::NoPen) pw = 0.9; if (c == QPicturePrivate::PdcDrawLine) pw /= (qAbs(worldMatrix.m11()) + qAbs(worldMatrix.m22())) / 2.0; - s += QString(QLatin1String("stroke-width:%1;")).arg(pw); + s += QString::fromLatin1("stroke-width:%1;").arg(pw); if (cpen.style() == Qt::DashLine) - s+= QString(QLatin1String("stroke-dasharray:18,6;")); + s+= QLatin1String("stroke-dasharray:18,6;"); else if (cpen.style() == Qt::DotLine) - s+= QString(QLatin1String("stroke-dasharray:3;")); + s+= QLatin1String("stroke-dasharray:3;"); else if (cpen.style() == Qt::DashDotLine) - s+= QString(QLatin1String("stroke-dasharray:9,6,3,6;")); + s+= QLatin1String("stroke-dasharray:9,6,3,6;"); else if (cpen.style() == Qt::DashDotDotLine) - s+= QString(QLatin1String("stroke-dasharray:9,3,3;")); + s+= QLatin1String("stroke-dasharray:9,3,3;"); if (cbrush.style() == Qt::NoBrush || c == QPicturePrivate::PdcDrawPolyline || c == QPicturePrivate::PdcDrawCubicBezier) s += QLatin1String("fill:none;"); // Qt polylines use no brush, neither do Beziers else - s += QString(QLatin1String("fill:rgb(%1,%2,%3);")).arg(bcol.red()).arg(bcol.green()).arg(bcol.blue()); + s += QString::fromLatin1("fill:rgb(%1,%2,%3);").arg(bcol.red()).arg(bcol.green()).arg(bcol.blue()); } e->setAttribute(QLatin1String("style"), s); } @@ -679,13 +679,13 @@ void Q3SVGPaintEnginePrivate::applyTransform(QDomElement *e) const bool rot = (m.m11() != 1.0 || m.m12() != 0.0 || m.m21() != 0.0 || m.m22() != 1.0); if (!rot && (m.dx() != 0.0 || m.dy() != 0.0)) { - s = QString(QLatin1String("translate(%1,%2)")).arg(m.dx()).arg(m.dy()); + s = QString::fromLatin1("translate(%1,%2)").arg(m.dx()).arg(m.dy()); } else if (rot) { if (m.m12() == 0.0 && m.m21() == 0.0 && m.dx() == 0.0 && m.dy() == 0.0) - s = QString(QLatin1String("scale(%1,%2)")).arg(m.m11()).arg(m.m22()); + s = QString::fromLatin1("scale(%1,%2)").arg(m.m11()).arg(m.m22()); else - s = QString(QLatin1String("matrix(%1,%2,%3,%4,%5,%6)")) + s = QString::fromLatin1("matrix(%1,%2,%3,%4,%5,%6)") .arg(m.m11()).arg(m.m12()) .arg(m.m21()).arg(m.m22()) .arg(m.dx()).arg(m.dy()); @@ -730,9 +730,9 @@ bool Q3SVGPaintEngine::play(QPainter *pt) d->brect.setX(x); d->brect.setY(y); QString wstr = attr.contains(QLatin1String("width")) - ? attr.namedItem(QLatin1String("width")).nodeValue() : QString(QLatin1String("100%")); + ? attr.namedItem(QLatin1String("width")).nodeValue() : QString::fromLatin1("100%"); QString hstr = attr.contains(QLatin1String("height")) - ? attr.namedItem(QLatin1String("height")).nodeValue() : QString(QLatin1String("100%")); + ? attr.namedItem(QLatin1String("height")).nodeValue() : QString::fromLatin1("100%"); double width = d->parseLen(wstr, 0, true); double height = d->parseLen(hstr, 0, false); // SVG doesn't respect x and y. But we want a proper bounding rect. diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp index e508001..d02f961 100644 --- a/src/qt3support/text/q3richtext.cpp +++ b/src/qt3support/text/q3richtext.cpp @@ -1678,7 +1678,7 @@ void Q3TextDocument::setRichTextInternal(const QString &text, Q3TextCursor* curs if (curtag.style->displayMode() == Q3StyleSheetItem::DisplayListItem) { // we are in a li and a new block comes along - if (nstyle->name() == QString(QLatin1String("ul")) || nstyle->name() == QLatin1String("ol")) + if (nstyle->name() == QLatin1String("ul") || nstyle->name() == QLatin1String("ol")) hasNewPar = false; // we want an empty li (like most browsers) if (!hasNewPar) { /* do not add new blocks inside @@ -1857,7 +1857,7 @@ void Q3TextDocument::setRichTextInternal(const QString &text, Q3TextCursor* curs curtag.format = curtag.format.makeTextFormat(nstyle, attr, scaleFontsFactor); if (nstyle->isAnchor()) { if (!anchorName.isEmpty()) - anchorName += QLatin1String("#") + attr[QLatin1String("name")]; + anchorName += QLatin1Char('#') + attr[QLatin1String("name")]; else anchorName = attr[QLatin1String("name")]; curtag.anchorHref = attr[QLatin1String("href")]; @@ -2436,7 +2436,7 @@ QString Q3TextDocument::richText() const list_type = QLatin1String(" type=") + list_style_to_string(p->listStyle()); for (int i = pastListDepth; i < listDepth; i++) { s += list_is_ordered(p->listStyle()) ? QLatin1String("<ol") : QLatin1String("<ul"); - s += list_type + QLatin1String(">"); + s += list_type + QLatin1Char('>'); } } else { s += QLatin1Char('\n'); @@ -2463,7 +2463,7 @@ QString Q3TextDocument::richText() const s += margin_to_string(item_li, p->utm, p->ubm, p->ulm, p->urm, p->uflm); s += list_value_to_string(p->listValue()); s += direction_to_string(p->direction()); - s += QLatin1String(">"); + s += QLatin1Char('>'); s += ps; s += QLatin1String("</li>"); } else if (p->listDepth()) { @@ -2471,7 +2471,7 @@ QString Q3TextDocument::richText() const s += align_to_string(p->alignment()); s += margin_to_string(item_div, p->utm, p->ubm, p->ulm, p->urm, p->uflm); s += direction_to_string(p->direction()); - s += QLatin1String(">"); + s += QLatin1Char('>'); s += ps; s += QLatin1String("</div>"); } else { @@ -2480,7 +2480,7 @@ QString Q3TextDocument::richText() const s += align_to_string(p->alignment()); s += margin_to_string(item_p, p->utm, p->ubm, p->ulm, p->urm, p->uflm); s += direction_to_string(p->direction()); - s += QLatin1String(">"); + s += QLatin1Char('>'); s += ps; s += QLatin1String("</p>"); } @@ -6667,7 +6667,7 @@ Q3TextImage::Q3TextImage(Q3TextDocument *p, const QMap<QString, QString> &attr, imageName = attr[QLatin1String("source")]; if (!imageName.isEmpty()) { - imgId = QString(QLatin1String("%1,%2,%3,%4")).arg(imageName).arg(width).arg(height).arg((ulong)&factory); + imgId = QString::fromLatin1("%1,%2,%3,%4").arg(imageName).arg(width).arg(height).arg((ulong)&factory); if (!pixmap_map) pixmap_map = new QMap<QString, QPixmapInt>; if (pixmap_map->contains(imgId)) { @@ -6761,13 +6761,13 @@ QString Q3TextImage::richText() const s += QLatin1String("<img "); QMap<QString, QString>::ConstIterator it = attributes.begin(); for (; it != attributes.end(); ++it) { - s += it.key() + QLatin1String("="); + s += it.key() + QLatin1Char('='); if ((*it).contains(QLatin1Char(' '))) - s += QLatin1String("\"") + *it + QLatin1String("\" "); + s += QLatin1Char('\"') + *it + QLatin1String("\" "); else - s += *it + QLatin1String(" "); + s += *it + QLatin1Char(' '); } - s += QLatin1String(">"); + s += QLatin1Char('>'); return s; } @@ -7722,7 +7722,7 @@ QString Q3TextTable::richText() const s = QLatin1String("<table "); QMap<QString, QString>::ConstIterator it = attributes.begin(); for (; it != attributes.end(); ++it) - s += it.key() + QLatin1String("=") + *it + QLatin1String(" "); + s += it.key() + QLatin1Char('=') + *it + QLatin1Char(' '); s += QLatin1String(">\n"); int lastRow = -1; @@ -7739,8 +7739,8 @@ QString Q3TextTable::richText() const s += QLatin1String("<td"); it = cell->attributes.constBegin(); for (; it != cell->attributes.constEnd(); ++it) - s += QLatin1String(" ") + it.key() + QLatin1String("=") + *it; - s += QLatin1String(">"); + s += QLatin1Char(' ') + it.key() + QLatin1Char('=') + *it; + s += QLatin1Char('>'); s += cell->richText()->richText(); s += QLatin1String("</td>"); } diff --git a/src/qt3support/text/q3textedit.cpp b/src/qt3support/text/q3textedit.cpp index 7577dce..d1db1e4 100644 --- a/src/qt3support/text/q3textedit.cpp +++ b/src/qt3support/text/q3textedit.cpp @@ -77,7 +77,7 @@ #include <qkeysequence.h> #define ACCEL_KEY(k) QLatin1Char('\t') + QString(QKeySequence(Qt::CTRL | Qt::Key_ ## k)) #else -#define ACCEL_KEY(k) QLatin1Char('\t' )+ QString(QLatin1String("Ctrl+" #k)) +#define ACCEL_KEY(k) QLatin1Char('\t' )+ QString::fromLatin1("Ctrl+" #k) #endif #ifdef QT_TEXTEDIT_OPTIMIZATION @@ -6625,7 +6625,7 @@ void Q3TextEdit::optimSetTextFormat(Q3TextDocument * td, Q3TextCursor * cur, } if (tag) { QString col = tag->tag.simplified(); - if (col.left(10) == QLatin1String("font color")) { + if (col.startsWith(QLatin1String("font color"))) { int i = col.indexOf(QLatin1Char('='), 10); col = col.mid(i + 1).simplified(); if (col[0] == QLatin1Char('\"')) diff --git a/src/qt3support/widgets/q3mainwindow.cpp b/src/qt3support/widgets/q3mainwindow.cpp index 2ee3bdc..ae80321 100644 --- a/src/qt3support/widgets/q3mainwindow.cpp +++ b/src/qt3support/widgets/q3mainwindow.cpp @@ -2261,7 +2261,7 @@ static void saveDockArea(QTextStream &ts, Q3DockArea *a) for (int i = 0; i < l.size(); ++i) { Q3DockWindow *dw = l.at(i); ts << QString(dw->windowTitle()); - ts << ","; + ts << ','; } ts << endl; ts << *a; @@ -2287,7 +2287,7 @@ QTextStream &operator<<(QTextStream &ts, const Q3MainWindow &mainWindow) for (int i = 0; i < l.size(); ++i) { Q3DockWindow *dw = l.at(i); ts << dw->windowTitle(); - ts << ","; + ts << ','; } ts << endl; @@ -2295,17 +2295,17 @@ QTextStream &operator<<(QTextStream &ts, const Q3MainWindow &mainWindow) for (int i = 0; i < l.size(); ++i) { Q3DockWindow *dw = l.at(i); ts << dw->windowTitle(); - ts << ","; + ts << ','; } ts << endl; for (int i = 0; i < l.size(); ++i) { Q3DockWindow *dw = l.at(i); - ts << "[" << dw->windowTitle() << "," - << (int)dw->geometry().x() << "," - << (int)dw->geometry().y() << "," - << (int)dw->geometry().width() << "," - << (int)dw->geometry().height() << "," - << (int)dw->isVisible() << "]"; + ts << '[' << dw->windowTitle() << ',' + << (int)dw->geometry().x() << ',' + << (int)dw->geometry().y() << ',' + << (int)dw->geometry().width() << ',' + << (int)dw->geometry().height() << ',' + << (int)dw->isVisible() << ']'; } ts << endl; diff --git a/src/script/qscriptcontext.cpp b/src/script/qscriptcontext.cpp index 020601b..ff519c7 100644 --- a/src/script/qscriptcontext.cpp +++ b/src/script/qscriptcontext.cpp @@ -469,7 +469,7 @@ QString QScriptContext::toString() const QScriptValue arg = argument(i); result.append(safeValueToString(arg)); } - result.append(QLatin1String(")")); + result.append(QLatin1Char(')')); QString fileName = info.fileName(); int lineNumber = info.lineNumber(); diff --git a/src/script/qscriptcontext_p.cpp b/src/script/qscriptcontext_p.cpp index 199c9d4..f19ba9c 100644 --- a/src/script/qscriptcontext_p.cpp +++ b/src/script/qscriptcontext_p.cpp @@ -841,7 +841,7 @@ Ltop: flags = iPtr->operand[1].m_int_value; #ifndef QT_NO_REGEXP if (flags != 0) { - literal += QLatin1String("/"); + literal += QLatin1Char('/'); literal += QString::number(flags); } #endif @@ -2396,10 +2396,10 @@ QStringList QScriptContextPrivate::backtrace() const s += QLatin1String("<global>"); } } - s += QLatin1String("("); + s += QLatin1Char('('); for (int i = 0; i < ctx->argc; ++i) { if (i > 0) - s += QLatin1String(","); + s += QLatin1Char(','); QScriptValueImpl arg = ctx->args[i]; if (arg.isObject()) s += QLatin1String("[object Object]"); // don't do a function call diff --git a/src/script/qscriptecmaerror.cpp b/src/script/qscriptecmaerror.cpp index fc39bf9..0dde68c 100644 --- a/src/script/qscriptecmaerror.cpp +++ b/src/script/qscriptecmaerror.cpp @@ -318,18 +318,18 @@ QStringList Error::backtrace(const QScriptValueImpl &error) } else { s += functionName; } - s += QLatin1String("("); + s += QLatin1Char('('); QScriptValueImpl arguments = frame.property(QLatin1String("arguments")); if (arguments.isObject()) { int argCount = arguments.property(QLatin1String("length")).toInt32(); for (int j = 0; j < argCount; ++j) { if (j > 0) - s += QLatin1String(","); + s += QLatin1Char(','); s += arguments.property(j).toString(); } } s += QLatin1String(")@") + o.property(QLatin1String("fileName")).toString() - + QLatin1String(":") + o.property(QLatin1String("lineNumber")).toString(); + + QLatin1Char(':') + o.property(QLatin1String("lineNumber")).toString(); result.append(s); } return result; diff --git a/src/script/qscriptecmafunction.cpp b/src/script/qscriptecmafunction.cpp index ec45ae4..a1e5b58 100644 --- a/src/script/qscriptecmafunction.cpp +++ b/src/script/qscriptecmafunction.cpp @@ -197,7 +197,7 @@ QString Function::buildFunction(QScriptContextPrivate *context) // the formals for (int i = 0; i < argc - 1; ++i) { if (i != 0) - code += QLatin1String(","); + code += QLatin1Char(','); code += context->argument(i).toString(); } diff --git a/src/script/qscriptecmaglobal.cpp b/src/script/qscriptecmaglobal.cpp index da7ab9e..b5cf675 100644 --- a/src/script/qscriptecmaglobal.cpp +++ b/src/script/qscriptecmaglobal.cpp @@ -296,7 +296,7 @@ public: QString result; for (int i = 0; i < context->argumentCount(); ++i) { if (i != 0) - result.append(QLatin1String(" ")); + result.append(QLatin1Char(' ')); QString s = context->argument(i).toString(); if (context->state() == QScriptContext::ExceptionState) diff --git a/src/script/qscriptecmaobject.cpp b/src/script/qscriptecmaobject.cpp index 694f479..c4a1b08 100644 --- a/src/script/qscriptecmaobject.cpp +++ b/src/script/qscriptecmaobject.cpp @@ -113,7 +113,7 @@ QScriptValueImpl Object::method_toString(QScriptContextPrivate *context, QScript QString s = QLatin1String("[object "); QScriptValueImpl self = context->thisObject(); s += self.classInfo()->name(); - s += QLatin1String("]"); + s += QLatin1Char(']'); return (QScriptValueImpl(eng, s)); } diff --git a/src/script/qscriptparser.cpp b/src/script/qscriptparser.cpp index 0b04df1..7408ec5 100644 --- a/src/script/qscriptparser.cpp +++ b/src/script/qscriptparser.cpp @@ -1148,9 +1148,9 @@ case 266: { error_message += QLatin1String (", "); first = false; - error_message += QLatin1String("`"); + error_message += QLatin1Char('`'); error_message += QLatin1String (spell [expected_tokens [s]]); - error_message += QLatin1String("'"); + error_message += QLatin1Char('\''); } } diff --git a/src/script/qscriptprettypretty.cpp b/src/script/qscriptprettypretty.cpp index 6ee1e55..b221b0a 100644 --- a/src/script/qscriptprettypretty.cpp +++ b/src/script/qscriptprettypretty.cpp @@ -73,13 +73,13 @@ PrettyPretty::~PrettyPretty() void PrettyPretty::acceptAsBlock(AST::Node *node) { - out << "{"; + out << '{'; pushIndentLevel(); newlineAndIndent(); accept(node); popIndentLevel(); newlineAndIndent(); - out << "}"; + out << '}'; } int PrettyPretty::operatorPrecedenceLevel(int op) @@ -230,8 +230,8 @@ void PrettyPretty::endVisit(AST::FalseLiteral *node) bool PrettyPretty::visit(AST::StringLiteral *node) { QString lit = QScriptEnginePrivate::toString(node->value); - lit.replace(QLatin1String("\\"), QLatin1String("\\\\")); - out << "\"" << lit << "\""; + lit.replace(QLatin1Char('\\'), QLatin1String("\\\\")); + out << '\"' << lit << '\"'; return false; } @@ -253,7 +253,7 @@ void PrettyPretty::endVisit(AST::NumericLiteral *node) bool PrettyPretty::visit(AST::RegExpLiteral *node) { - out << "/" << QScriptEnginePrivate::toString(node->pattern) << "/"; + out << '/' << QScriptEnginePrivate::toString(node->pattern) << '/'; if (node->flags) out << QScript::Ecma::RegExp::flagsToString(node->flags); @@ -267,10 +267,10 @@ void PrettyPretty::endVisit(AST::RegExpLiteral *node) bool PrettyPretty::visit(AST::ArrayLiteral *node) { - out << "["; + out << '['; accept(node->elements); accept(node->elision); - out << "]"; + out << ']'; return false; } @@ -281,7 +281,7 @@ void PrettyPretty::endVisit(AST::ArrayLiteral *node) bool PrettyPretty::visit(AST::ObjectLiteral *node) { - out << "{"; + out << '{'; if (node->properties) { pushIndentLevel(); AST::PropertyNameAndValueList *prop; @@ -289,12 +289,12 @@ bool PrettyPretty::visit(AST::ObjectLiteral *node) newlineAndIndent(); accept(prop); if (prop->next) - out << ","; + out << ','; } popIndentLevel(); newlineAndIndent(); } - out << "}"; + out << '}'; return false; } @@ -384,9 +384,9 @@ void PrettyPretty::endVisit(AST::NumericLiteralPropertyName *node) bool PrettyPretty::visit(AST::ArrayMemberExpression *node) { accept(node->base); - out << "["; + out << '['; accept(node->expression); - out << "]"; + out << ']'; return false; } @@ -398,7 +398,7 @@ void PrettyPretty::endVisit(AST::ArrayMemberExpression *node) bool PrettyPretty::visit(AST::FieldMemberExpression *node) { accept(node->base); - out << "." << QScriptEnginePrivate::toString(node->name); + out << '.' << QScriptEnginePrivate::toString(node->name); return false; } @@ -411,9 +411,9 @@ bool PrettyPretty::visit(AST::NewMemberExpression *node) { out << "new "; accept(node->base); - out << "("; + out << '('; accept(node->arguments); - out << ")"; + out << ')'; return false; } @@ -437,9 +437,9 @@ void PrettyPretty::endVisit(AST::NewExpression *node) bool PrettyPretty::visit(AST::CallExpression *node) { accept(node->base); - out << "("; + out << '('; accept(node->arguments); - out << ")"; + out << ')'; return false; } @@ -549,13 +549,13 @@ void PrettyPretty::endVisit(AST::PreDecrementExpression *node) bool PrettyPretty::visit(AST::UnaryPlusExpression *node) { - out << "+"; + out << '+'; bool needParens = (node->expression->binaryExpressionCast() != 0); if (needParens) - out << "("; + out << '('; accept(node->expression); if (needParens) - out << ")"; + out << ')'; return false; } @@ -566,13 +566,13 @@ void PrettyPretty::endVisit(AST::UnaryPlusExpression *node) bool PrettyPretty::visit(AST::UnaryMinusExpression *node) { - out << "-"; + out << '-'; bool needParens = (node->expression->binaryExpressionCast() != 0); if (needParens) - out << "("; + out << '('; accept(node->expression); if (needParens) - out << ")"; + out << ')'; return false; } @@ -583,13 +583,13 @@ void PrettyPretty::endVisit(AST::UnaryMinusExpression *node) bool PrettyPretty::visit(AST::TildeExpression *node) { - out << "~"; + out << '~'; bool needParens = (node->expression->binaryExpressionCast() != 0); if (needParens) - out << "("; + out << '('; accept(node->expression); if (needParens) - out << ")"; + out << ')'; return false; } @@ -600,13 +600,13 @@ void PrettyPretty::endVisit(AST::TildeExpression *node) bool PrettyPretty::visit(AST::NotExpression *node) { - out << "!"; + out << '!'; bool needParens = (node->expression->binaryExpressionCast() != 0); if (needParens) - out << "("; + out << '('; accept(node->expression); if (needParens) - out << ")"; + out << ')'; return false; } @@ -620,10 +620,10 @@ bool PrettyPretty::visit(AST::BinaryExpression *node) bool needParens = node->left->binaryExpressionCast() && (compareOperatorPrecedence(node->left->binaryExpressionCast()->op, node->op) < 0); if (needParens) - out << "("; + out << '('; accept(node->left); if (needParens) - out << ")"; + out << ')'; QString s; switch (node->op) { case QSOperator::Add: @@ -699,14 +699,14 @@ bool PrettyPretty::visit(AST::BinaryExpression *node) default: Q_ASSERT (0); } - out << " " << s << " "; + out << ' ' << s << ' '; needParens = node->right->binaryExpressionCast() && (compareOperatorPrecedence(node->right->binaryExpressionCast()->op, node->op) <= 0); if (needParens) - out << "("; + out << '('; accept(node->right); if (needParens) - out << ")"; + out << ')'; return false; } @@ -798,7 +798,7 @@ bool PrettyPretty::visit(AST::VariableStatement *node) void PrettyPretty::endVisit(AST::VariableStatement *node) { Q_UNUSED(node); - out << ";"; + out << ';'; } bool PrettyPretty::visit(AST::VariableDeclaration *node) @@ -819,7 +819,7 @@ void PrettyPretty::endVisit(AST::VariableDeclaration *node) bool PrettyPretty::visit(AST::EmptyStatement *node) { Q_UNUSED(node); - out << ";"; + out << ';'; return true; } @@ -831,7 +831,7 @@ void PrettyPretty::endVisit(AST::EmptyStatement *node) bool PrettyPretty::visit(AST::ExpressionStatement *node) { accept(node->expression); - out << ";"; + out << ';'; return false; } @@ -959,9 +959,9 @@ bool PrettyPretty::visit(AST::ContinueStatement *node) { out << "continue"; if (node->label) { - out << " " << QScriptEnginePrivate::toString(node->label); + out << ' ' << QScriptEnginePrivate::toString(node->label); } - out << ";"; + out << ';'; return false; } @@ -974,9 +974,9 @@ bool PrettyPretty::visit(AST::BreakStatement *node) { out << "break"; if (node->label) { - out << " " << QScriptEnginePrivate::toString(node->label); + out << ' ' << QScriptEnginePrivate::toString(node->label); } - out << ";"; + out << ';'; return false; } @@ -989,10 +989,10 @@ bool PrettyPretty::visit(AST::ReturnStatement *node) { out << "return"; if (node->expression) { - out << " "; + out << ' '; accept(node->expression); } - out << ";"; + out << ';'; return false; } @@ -1067,7 +1067,7 @@ bool PrettyPretty::visit(AST::CaseClause *node) { out << "case "; accept(node->expression); - out << ":"; + out << ':'; if (node->statements) { newlineAndIndent(); accept(node->statements); @@ -1109,7 +1109,7 @@ bool PrettyPretty::visit(AST::ThrowStatement *node) Q_UNUSED(node); out << "throw "; accept(node->expression); - out << ";"; + out << ';'; return false; } @@ -1166,10 +1166,10 @@ bool PrettyPretty::visit(AST::FunctionDeclaration *node) out << "function"; if (node->name) - out << " " << QScriptEnginePrivate::toString(node->name); + out << ' ' << QScriptEnginePrivate::toString(node->name); // the arguments - out << "("; + out << '('; for (AST::FormalParameterList *it = node->formals; it; it = it->next) { if (it->name) out << QScriptEnginePrivate::toString(it->name); @@ -1177,7 +1177,7 @@ bool PrettyPretty::visit(AST::FunctionDeclaration *node) if (it->next) out << ", "; } - out << ")"; + out << ')'; // the function body out << " {"; @@ -1190,7 +1190,7 @@ bool PrettyPretty::visit(AST::FunctionDeclaration *node) newlineAndIndent(); } - out << "}"; + out << '}'; return false; } @@ -1205,10 +1205,10 @@ bool PrettyPretty::visit(AST::FunctionExpression *node) out << "function"; if (node->name) - out << " " << QScriptEnginePrivate::toString(node->name); + out << ' ' << QScriptEnginePrivate::toString(node->name); // the arguments - out << "("; + out << '('; for (AST::FormalParameterList *it = node->formals; it; it = it->next) { if (it->name) out << QScriptEnginePrivate::toString(it->name); @@ -1216,7 +1216,7 @@ bool PrettyPretty::visit(AST::FunctionExpression *node) if (it->next) out << ", "; } - out << ")"; + out << ')'; // the function body out << " {"; @@ -1229,7 +1229,7 @@ bool PrettyPretty::visit(AST::FunctionExpression *node) newlineAndIndent(); } - out << "}"; + out << '}'; return false; } @@ -1320,7 +1320,7 @@ bool PrettyPretty::visit(AST::DebuggerStatement *node) void PrettyPretty::endVisit(AST::DebuggerStatement *node) { Q_UNUSED(node); - out << ";"; + out << ';'; } bool PrettyPretty::preVisit(AST::Node *node) diff --git a/src/script/qscriptsyntaxchecker.cpp b/src/script/qscriptsyntaxchecker.cpp index 9653bc1..74ca00f 100644 --- a/src/script/qscriptsyntaxchecker.cpp +++ b/src/script/qscriptsyntaxchecker.cpp @@ -186,9 +186,9 @@ SyntaxChecker::Result SyntaxChecker::checkSyntax(const QString &code) error_message += QLatin1String (", "); first = false; - error_message += QLatin1String("`"); + error_message += QLatin1Char('`'); error_message += QLatin1String (spell [expected_tokens [s]]); - error_message += QLatin1String("'"); + error_message += QLatin1Char('\''); } } diff --git a/src/script/qscriptvalueimpl.cpp b/src/script/qscriptvalueimpl.cpp index 15d1b8a..a890839 100644 --- a/src/script/qscriptvalueimpl.cpp +++ b/src/script/qscriptvalueimpl.cpp @@ -395,7 +395,7 @@ QDebug &operator<<(QDebug &d, const QScriptValueImpl &object) QScriptObject *od = object.objectValue(); for (int i=0; i<od->memberCount(); ++i) { if (i != 0) - d << ","; + d << ','; QScript::Member m; od->member(i, &m); @@ -404,7 +404,7 @@ QDebug &operator<<(QDebug &d, const QScriptValueImpl &object) d << object.engine()->toString(m.nameId()); QScriptValueImpl o; od->get(m, &o); - d.nospace() << QLatin1String(":") + d.nospace() << QLatin1Char(':') << (o.classInfo() ? o.classInfo()->name() : QLatin1String("?")); @@ -415,14 +415,14 @@ QDebug &operator<<(QDebug &d, const QScriptValueImpl &object) QScriptValueImpl scope = object.scope(); while (scope.isValid()) { Q_ASSERT(scope.isObject()); - d.nospace() << " " << scope.objectValue(); + d.nospace() << ' ' << scope.objectValue(); scope = scope.scope(); } - d.nospace() << "}"; + d.nospace() << '}'; break; } - d << ")"; + d << ')'; return d; } diff --git a/src/script/qscriptxmlgenerator.cpp b/src/script/qscriptxmlgenerator.cpp index 131882b..163b60c 100644 --- a/src/script/qscriptxmlgenerator.cpp +++ b/src/script/qscriptxmlgenerator.cpp @@ -121,10 +121,10 @@ QTextStream &XmlGenerator::startTag(const QString &name, AST::Node *locationNode { pushIndentLevel(); newlineAndIndent(); - out << QLatin1String("<") << name; + out << QLatin1Char('<') << name; if (locationNode) - out << QLatin1String(" line=\"") << locationNode->startLine << QLatin1String("\""); - out << QLatin1String(">"); + out << QLatin1String(" line=\"") << locationNode->startLine << QLatin1Char('\"'); + out << QLatin1Char('>'); return out; } @@ -132,7 +132,7 @@ QTextStream &XmlGenerator::endTag(const QString &name) { newlineAndIndent(); popIndentLevel(); - out << QLatin1String("</") << escape(name) << QLatin1String(">"); + out << QLatin1String("</") << escape(name) << QLatin1Char('>'); return out; } @@ -233,7 +233,7 @@ void XmlGenerator::endVisit(AST::NumericLiteral *) bool XmlGenerator::visit(AST::RegExpLiteral *node) { startTag(QLatin1String("regexp")); - out << QLatin1String("/") << escape(QScriptEnginePrivate::toString(node->pattern)) << QLatin1String("/"); + out << QLatin1Char('/') << escape(QScriptEnginePrivate::toString(node->pattern)) << QLatin1Char('/'); if (node->flags) out << QScript::Ecma::RegExp::flagsToString(node->flags); out << QLatin1String("</regexp>"); diff --git a/src/scripttools/debugging/qscriptcompletiontask.cpp b/src/scripttools/debugging/qscriptcompletiontask.cpp index 119b96a..2f3c2cf 100644 --- a/src/scripttools/debugging/qscriptcompletiontask.cpp +++ b/src/scripttools/debugging/qscriptcompletiontask.cpp @@ -158,7 +158,7 @@ void QScriptCompletionTaskPrivate::completeScriptExpression() if (path.size() > 1) { const QString &topLevelIdent = path.at(0); QScriptValue obj; - if (topLevelIdent == QString::fromLatin1("this")) { + if (topLevelIdent == QLatin1String("this")) { obj = ctx->thisObject(); } else { QScriptValueList scopeChain; @@ -256,9 +256,9 @@ void QScriptCompletionTask::start() } QString argType = cmd->argumentTypes().value(argNum); if (!argType.isEmpty()) { - if (argType == QString::fromLatin1("command-or-group-name")) { + if (argType == QLatin1String("command-or-group-name")) { d->results = d->console->commandManager()->completions(arg); - } else if (argType == QString::fromLatin1("script-filename")) { + } else if (argType == QLatin1String("script-filename")) { // ### super-cheating for now; have to use the async API QScriptEngineDebuggerFrontend *edf = static_cast<QScriptEngineDebuggerFrontend*>(d->frontend); QScriptDebuggerBackend *backend = edf->backend(); @@ -269,13 +269,13 @@ void QScriptCompletionTask::start() if (isPrefixOf(arg, fileName)) d->results.append(fileName); } - } else if (argType == QString::fromLatin1("subcommand-name")) { + } else if (argType == QLatin1String("subcommand-name")) { for (int i = 0; i < cmd->subCommands().size(); ++i) { QString name = cmd->subCommands().at(i); if (isPrefixOf(arg, name)) d->results.append(name); } - } else if (argType == QString::fromLatin1("script")) { + } else if (argType == QLatin1String("script")) { d->completeScriptExpression(); } if ((d->type == NoCompletion) && !d->results.isEmpty()) { diff --git a/src/scripttools/debugging/qscriptdebuggerbackend.cpp b/src/scripttools/debugging/qscriptdebuggerbackend.cpp index 3c29130..0771d0b 100644 --- a/src/scripttools/debugging/qscriptdebuggerbackend.cpp +++ b/src/scripttools/debugging/qscriptdebuggerbackend.cpp @@ -292,7 +292,7 @@ QScriptValue QScriptDebuggerBackendPrivate::trace(QScriptContext *context, QString str; for (int i = 0; i < context->argumentCount(); ++i) { if (i > 0) - str.append(QLatin1String(" ")); + str.append(QLatin1Char(' ')); str.append(context->argument(i).toString()); } QScriptDebuggerEvent e(QScriptDebuggerEvent::Trace); diff --git a/src/scripttools/debugging/qscriptdebuggerconsole.cpp b/src/scripttools/debugging/qscriptdebuggerconsole.cpp index 70bb8b1..546ec63 100644 --- a/src/scripttools/debugging/qscriptdebuggerconsole.cpp +++ b/src/scripttools/debugging/qscriptdebuggerconsole.cpp @@ -163,10 +163,10 @@ QScriptDebuggerConsoleCommandJob *QScriptDebuggerConsolePrivate::createJob( .arg(name)); for (int j = 0; j < completions.size(); ++j) { if (j > 0) - msg.append(QString::fromLatin1(", ")); + msg.append(QLatin1String(", ")); msg.append(completions.at(j)); } - msg.append(QString::fromLatin1(".")); + msg.append(QLatin1Char('.')); messageHandler->message(QtWarningMsg, msg); return 0; } diff --git a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp index caeb971..e096ba8 100644 --- a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp +++ b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp @@ -807,7 +807,7 @@ QVariant QScriptDebuggerLocalsModel::data(const QModelIndex &index, int role) co QString str = node->property.valueAsString(); if (node->property.value().type() == QScriptDebuggerValue::StringValue) { // escape - str.replace(QLatin1String("\""), QLatin1String("\\\"")); + str.replace(QLatin1Char('\"'), QLatin1String("\\\"")); str.prepend(QLatin1Char('\"')); str.append(QLatin1Char('\"')); } diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp index 11d0041..c7cbc9b 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/sql/drivers/db2/qsql_db2.cpp @@ -1666,7 +1666,7 @@ QVariant QDB2Driver::handle() const QString QDB2Driver::escapeIdentifier(const QString &identifier, IdentifierType) const { QString res = identifier; - if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { + if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 1645555..199ad8e 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1732,7 +1732,7 @@ bool QIBaseDriver::subscribeToNotificationImplementation(const QString &name) eBuffer->resultBuffer); if (status[0] == 1 && status[1]) { - setLastError(QSqlError(QString(QLatin1String("Could not subscribe to event notifications for %1.")).arg(name))); + setLastError(QSqlError(QString::fromLatin1("Could not subscribe to event notifications for %1.").arg(name))); d->eventBuffers.remove(name); qFreeEventBuffer(eBuffer); return false; @@ -1760,7 +1760,7 @@ bool QIBaseDriver::unsubscribeFromNotificationImplementation(const QString &name isc_cancel_events(status, &d->ibase, &eBuffer->eventId); if (status[0] == 1 && status[1]) { - setLastError(QSqlError(QString(QLatin1String("Could not unsubscribe from event notifications for %1.")).arg(name))); + setLastError(QSqlError(QString::fromLatin1("Could not unsubscribe from event notifications for %1.").arg(name))); return false; } @@ -1818,7 +1818,7 @@ void QIBaseDriver::qHandleEventNotification(void *updatedResultBuffer) QString QIBaseDriver::escapeIdentifier(const QString &identifier, IdentifierType) const { QString res = identifier; - if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { + if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index 53645c9..82ed124 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -1468,7 +1468,7 @@ QString QMYSQLDriver::formatValue(const QSqlField &field, bool trimStrings) cons QString QMYSQLDriver::escapeIdentifier(const QString &identifier, IdentifierType) const { QString res = identifier; - if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('`')) && identifier.right(1) != QString(QLatin1Char('`')) ) { + if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('`')) && !identifier.endsWith(QLatin1Char('`')) ) { res.prepend(QLatin1Char('`')).append(QLatin1Char('`')); res.replace(QLatin1Char('.'), QLatin1String("`.`")); } @@ -1478,12 +1478,9 @@ QString QMYSQLDriver::escapeIdentifier(const QString &identifier, IdentifierType bool QMYSQLDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const { Q_UNUSED(type); - bool isLeftDelimited = (identifier.left(1) == QString(QLatin1Char('`'))); - bool isRightDelimited = (identifier.right(1) == QString(QLatin1Char('`'))); - if( identifier.size() > 2 && isLeftDelimited && isRightDelimited ) - return true; - else - return false; + return identifier.size() > 2 + && identifier.startsWith(QLatin1Char('`')) //left delimited + && identifier.endsWith(QLatin1Char('`')); //right delimited } QT_END_NAMESPACE diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index a7031b1..e6ee63d 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -2040,8 +2040,8 @@ bool QOCIDriver::open(const QString & db, QString connectionString = db; if (!hostname.isEmpty()) connectionString = - QString(QLatin1String("(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=%1)(Port=%2))" - "(CONNECT_DATA=(SID=%3)))")).arg(hostname).arg((port > -1 ? port : 1521)).arg(db); + QString::fromLatin1("(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=%1)(Port=%2))" + "(CONNECT_DATA=(SID=%3)))").arg(hostname).arg((port > -1 ? port : 1521)).arg(db); r = OCIHandleAlloc(d->env, reinterpret_cast<void **>(&d->srvhp), OCI_HTYPE_SERVER, 0, 0); if (r == OCI_SUCCESS) @@ -2219,7 +2219,7 @@ QStringList QOCIDriver::tables(QSql::TableType type) const while (t.next()) { if (t.value(0).toString().toUpper() != user.toUpper()) - tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); + tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); else tl.append(t.value(1).toString()); } @@ -2235,7 +2235,7 @@ QStringList QOCIDriver::tables(QSql::TableType type) const "and owner != 'WMSYS'")); while (t.next()) { if (t.value(0).toString().toUpper() != d->user.toUpper()) - tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); + tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); else tl.append(t.value(1).toString()); } @@ -2297,7 +2297,7 @@ QSqlRecord QOCIDriver::record(const QString& tablename) const else owner = owner.toUpper(); - tmpStmt += QLatin1String(" and owner='") + owner + QLatin1String("'"); + tmpStmt += QLatin1String(" and owner='") + owner + QLatin1Char('\''); t.setForwardOnly(true); t.exec(tmpStmt); if (!t.next()) { // try and see if the tablename is a synonym @@ -2352,7 +2352,7 @@ QSqlIndex QOCIDriver::primaryIndex(const QString& tablename) const else table = table.toUpper(); - tmpStmt = stmt + QLatin1String(" and a.table_name='") + table + QLatin1String("'"); + tmpStmt = stmt + QLatin1String(" and a.table_name='") + table + QLatin1Char('\''); if (owner.isEmpty()) { owner = d->user; } @@ -2362,7 +2362,7 @@ QSqlIndex QOCIDriver::primaryIndex(const QString& tablename) const else owner = owner.toUpper(); - tmpStmt += QLatin1String(" and a.owner='") + owner + QLatin1String("'"); + tmpStmt += QLatin1String(" and a.owner='") + owner + QLatin1Char('\''); t.setForwardOnly(true); t.exec(tmpStmt); @@ -2386,7 +2386,7 @@ QSqlIndex QOCIDriver::primaryIndex(const QString& tablename) const tt.exec(QLatin1String("select data_type from all_tab_columns where table_name='") + t.value(2).toString() + QLatin1String("' and column_name='") + t.value(0).toString() + QLatin1String("' and owner='") + - owner +QLatin1String("'")); + owner + QLatin1Char('\'')); if (!tt.next()) { return QSqlIndex(); } diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index ee500a0..8eaa8bf 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -213,14 +213,14 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode static QString qODBCWarn(const QODBCPrivate* odbc, int *nativeCode = 0) { - return (qWarnODBCHandle(SQL_HANDLE_ENV, odbc->hEnv) + QLatin1String(" ") - + qWarnODBCHandle(SQL_HANDLE_DBC, odbc->hDbc) + QLatin1String(" ") + return (qWarnODBCHandle(SQL_HANDLE_ENV, odbc->hEnv) + QLatin1Char(' ') + + qWarnODBCHandle(SQL_HANDLE_DBC, odbc->hDbc) + QLatin1Char(' ') + qWarnODBCHandle(SQL_HANDLE_STMT, odbc->hStmt, nativeCode)); } static QString qODBCWarn(const QODBCDriverPrivate* odbc, int *nativeCode = 0) { - return (qWarnODBCHandle(SQL_HANDLE_ENV, odbc->hEnv) + QLatin1String(" ") + return (qWarnODBCHandle(SQL_HANDLE_ENV, odbc->hEnv) + QLatin1Char(' ') + qWarnODBCHandle(SQL_HANDLE_DBC, odbc->hDbc, nativeCode)); } @@ -2414,12 +2414,12 @@ QString QODBCDriver::escapeIdentifier(const QString &identifier, IdentifierType) { QString res = identifier; if (d->isMySqlServer) { - if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('`')) && identifier.right(1) != QString(QLatin1Char('`')) ) { + if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('`')) && !identifier.endsWith(QLatin1Char('`')) ) { res.prepend(QLatin1Char('`')).append(QLatin1Char('`')); res.replace(QLatin1Char('.'), QLatin1String("`.`")); } } else { - if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { + if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); @@ -2430,13 +2430,10 @@ QString QODBCDriver::escapeIdentifier(const QString &identifier, IdentifierType) bool QODBCDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType) const { - QString quote = d->quoteChar(); - bool isLeftDelimited = identifier.left(1) == quote; - bool isRightDelimited = identifier.right(1) == quote; - if( identifier.size() > 2 && isLeftDelimited && isRightDelimited ) - return true; - else - return false; + QChar quote = d->quoteChar(); + return identifier.size() > 2 + && identifier.startsWith(quote) //left delimited + && identifier.endsWith(quote); //right delimited } QT_END_NAMESPACE diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 16d19f1..ce0b8c5 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -541,7 +541,7 @@ bool QPSQLResult::prepare(const QString &query) qDeallocatePreparedStmt(d); const QString stmtId = qMakePreparedStmtId(); - const QString stmt = QString(QLatin1String("PREPARE %1 AS ")).arg(stmtId).append(qReplacePlaceholderMarkers(query)); + const QString stmt = QString::fromLatin1("PREPARE %1 AS ").arg(stmtId).append(qReplacePlaceholderMarkers(query)); PGresult *result = PQexec(d->driver->connection, d->driver->isUtf8 ? stmt.toUtf8().constData() @@ -570,9 +570,9 @@ bool QPSQLResult::exec() QString stmt; const QString params = qCreateParamString(boundValues(), d->q->driver()); if (params.isEmpty()) - stmt = QString(QLatin1String("EXECUTE %1")).arg(d->preparedStmtId); + stmt = QString::fromLatin1("EXECUTE %1").arg(d->preparedStmtId); else - stmt = QString(QLatin1String("EXECUTE %1 (%2)")).arg(d->preparedStmtId).arg(params); + stmt = QString::fromLatin1("EXECUTE %1 (%2)").arg(d->preparedStmtId).arg(params); d->result = PQexec(d->driver->connection, d->driver->isUtf8 ? stmt.toUtf8().constData() @@ -1102,12 +1102,12 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const QTime tm = field.value().toDateTime().time(); // msecs need to be right aligned otherwise psql // interpretes them wrong - r = QLatin1String("'") + QString::number(dt.year()) + QLatin1String("-") - + QString::number(dt.month()) + QLatin1String("-") - + QString::number(dt.day()) + QLatin1String(" ") - + tm.toString() + QLatin1String(".") + r = QLatin1Char('\'') + QString::number(dt.year()) + QLatin1Char('-') + + QString::number(dt.month()) + QLatin1Char('-') + + QString::number(dt.day()) + QLatin1Char(' ') + + tm.toString() + QLatin1Char('.') + QString::number(tm.msec()).rightJustified(3, QLatin1Char('0')) - + QLatin1String("'"); + + QLatin1Char('\''); } else { r = QLatin1String("NULL"); } @@ -1162,7 +1162,7 @@ QString QPSQLDriver::formatValue(const QSqlField &field, bool trimStrings) const QString QPSQLDriver::escapeIdentifier(const QString &identifier, IdentifierType) const { QString res = identifier; - if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { + if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); @@ -1195,7 +1195,7 @@ bool QPSQLDriver::subscribeToNotificationImplementation(const QString &name) int socket = PQsocket(d->connection); if (socket) { - QString query = QString(QLatin1String("LISTEN %1")).arg(escapeIdentifier(name, QSqlDriver::TableName)); + QString query = QLatin1String("LISTEN ") + escapeIdentifier(name, QSqlDriver::TableName); if (PQresultStatus(PQexec(d->connection, d->isUtf8 ? query.toUtf8().constData() : query.toLocal8Bit().constData()) @@ -1227,7 +1227,7 @@ bool QPSQLDriver::unsubscribeFromNotificationImplementation(const QString &name) return false; } - QString query = QString(QLatin1String("UNLISTEN %1")).arg(escapeIdentifier(name, QSqlDriver::TableName)); + QString query = QLatin1String("UNLISTEN ") + escapeIdentifier(name, QSqlDriver::TableName); if (PQresultStatus(PQexec(d->connection, d->isUtf8 ? query.toUtf8().constData() : query.toLocal8Bit().constData()) diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index f732077..05d63ca 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -631,9 +631,9 @@ static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString &tableName, bool only { QString schema; QString table(tableName); - int indexOfSeparator = tableName.indexOf(QLatin1String(".")); + int indexOfSeparator = tableName.indexOf(QLatin1Char('.')); if (indexOfSeparator > -1) { - schema = tableName.left(indexOfSeparator).append(QLatin1String(".")); + schema = tableName.left(indexOfSeparator).append(QLatin1Char('.')); table = tableName.mid(indexOfSeparator + 1); } q.exec(QLatin1String("PRAGMA ") + schema + QLatin1String("table_info ('") + table + QLatin1String("')")); diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp index d0c6e18..cb72ff0 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp @@ -170,8 +170,8 @@ void QSQLite2ResultPrivate::init(const char **cnames, int numCols) //remove quotations around the field name if any QString fieldStr = QString::fromAscii(fieldName); - QString quote = QString::fromLatin1("\""); - if ( fieldStr.length() > 2 && fieldStr.left(1) == quote && fieldStr.right(1) == quote) { + QLatin1Char quote('\"'); + if ( fieldStr.length() > 2 && fieldStr.startsWith(quote) && fieldStr.endsWith(quote)) { fieldStr = fieldStr.mid(1); fieldStr.chop(1); } @@ -561,7 +561,7 @@ QVariant QSQLite2Driver::handle() const QString QSQLite2Driver::escapeIdentifier(const QString &identifier, IdentifierType /*type*/) const { QString res = identifier; - if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { + if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp index 515f0de..298b008 100644 --- a/src/sql/drivers/tds/qsql_tds.cpp +++ b/src/sql/drivers/tds/qsql_tds.cpp @@ -181,7 +181,7 @@ static int CS_PUBLIC qTdsMsgHandler (DBPROCESS* dbproc, } if (severity > 0) { - QString errMsg = QString(QLatin1String("%1 (%2)")).arg(QString::fromAscii(msgtext)).arg( + QString errMsg = QString::fromLatin1("%1 (%2)").arg(QString::fromAscii(msgtext)).arg( msgstate); p->addErrorMsg(errMsg); } @@ -211,8 +211,8 @@ static int CS_PUBLIC qTdsErrHandler(DBPROCESS* dbproc, } - QString errMsg = QString(QLatin1String("%1 %2\n")).arg(QString::fromAscii(dberrstr)).arg( - QString::fromAscii(oserrstr)); + QString errMsg = QString::fromLatin1("%1 %2\n").arg(QLatin1String(dberrstr)).arg( + QLatin1String(oserrstr)); errMsg += p->getErrorMsgs(); p->lastError = qMakeError(errMsg, QSqlError::UnknownError, dberr); p->clearErrorMsgs(); diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp index 40bc0df..477d531 100644 --- a/src/sql/kernel/qsqldriver.cpp +++ b/src/sql/kernel/qsqldriver.cpp @@ -520,7 +520,7 @@ QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName, continue; s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1String(", ")); if (preparedStatement) - vals.append(QLatin1String("?")); + vals.append(QLatin1Char('?')); else vals.append(formatValue(rec.field(i))); vals.append(QLatin1String(", ")); @@ -530,7 +530,7 @@ QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName, } else { vals.chop(2); // remove trailing comma s[s.length() - 2] = QLatin1Char(')'); - s.append(QLatin1String("VALUES (")).append(vals).append(QLatin1String(")")); + s.append(QLatin1String("VALUES (")).append(vals).append(QLatin1Char(')')); } break; } } @@ -625,10 +625,7 @@ QString QSqlDriver::formatValue(const QSqlField &field, bool trimStrings) const break; } case QVariant::Bool: - if (field.value().toBool()) - r = QLatin1String("1"); - else - r = QLatin1String("0"); + r = QString::number(field.value().toBool()); break; case QVariant::ByteArray : { if (hasFeature(BLOB)) { @@ -884,12 +881,9 @@ QStringList QSqlDriver::subscribedToNotificationsImplementation() const bool QSqlDriver::isIdentifierEscapedImplementation(const QString &identifier, IdentifierType type) const { Q_UNUSED(type); - bool isLeftDelimited = identifier.left(1) == QString(QLatin1Char('"')); - bool isRightDelimited = identifier.right(1) == QString(QLatin1Char('"')); - if( identifier.size() > 2 && isLeftDelimited && isRightDelimited ) - return true; - else - return false; + return identifier.size() > 2 + && identifier.startsWith(QLatin1Char('"')) //left delimited + && identifier.endsWith(QLatin1Char('"')); //right delimited } /*! diff --git a/src/sql/kernel/qsqlerror.cpp b/src/sql/kernel/qsqlerror.cpp index 14fc050..b1fa6e2 100644 --- a/src/sql/kernel/qsqlerror.cpp +++ b/src/sql/kernel/qsqlerror.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE QDebug operator<<(QDebug dbg, const QSqlError &s) { dbg.nospace() << "QSqlError(" << s.number() << ", " << s.driverText() << - ", " << s.databaseText() << ")"; + ", " << s.databaseText() << ')'; return dbg.space(); } #endif diff --git a/src/sql/kernel/qsqlfield.cpp b/src/sql/kernel/qsqlfield.cpp index 8a808b6..46a5135 100644 --- a/src/sql/kernel/qsqlfield.cpp +++ b/src/sql/kernel/qsqlfield.cpp @@ -514,8 +514,8 @@ QDebug operator<<(QDebug dbg, const QSqlField &f) if (f.typeID() >= 0) dbg.nospace() << ", typeID: " << f.typeID(); if (!f.defaultValue().isNull()) - dbg.nospace() << ", auto-value: \"" << f.defaultValue() << "\""; - dbg.nospace() << ")"; + dbg.nospace() << ", auto-value: \"" << f.defaultValue() << '\"'; + dbg.nospace() << ')'; return dbg.space(); #else qWarning("This compiler doesn't support streaming QSqlField to QDebug"); diff --git a/src/sql/kernel/qsqlrecord.cpp b/src/sql/kernel/qsqlrecord.cpp index 0162664..95f6020 100644 --- a/src/sql/kernel/qsqlrecord.cpp +++ b/src/sql/kernel/qsqlrecord.cpp @@ -589,7 +589,7 @@ void QSqlRecord::detach() #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QSqlRecord &r) { - dbg << "QSqlRecord(" << r.count() << ")"; + dbg << "QSqlRecord(" << r.count() << ')'; for (int i = 0; i < r.count(); ++i) dbg << '\n' << QString::fromLatin1("%1:").arg(i, 2) << r.field(i) << r.value(i).toString(); return dbg; diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp index 12eae84..1b8fb4c 100644 --- a/src/sql/models/qsqlrelationaltablemodel.cpp +++ b/src/sql/models/qsqlrelationaltablemodel.cpp @@ -573,7 +573,7 @@ QString QSqlRelationalTableModel::selectStatement() const } // this needs fixing!! the below if is borken. - tables.append(relation.tableName().append(QLatin1String(" ")).append(relTableAlias)); + tables.append(relation.tableName().append(QLatin1Char(' ')).append(relTableAlias)); if(!where.isEmpty()) where.append(QLatin1String(" AND ")); where.append(d->relationField(tableName(), d->db.driver()->escapeIdentifier(rec.fieldName(i), QSqlDriver::FieldName))); diff --git a/src/svg/qsvggenerator.cpp b/src/svg/qsvggenerator.cpp index 2d351ff..d51636f 100644 --- a/src/svg/qsvggenerator.cpp +++ b/src/svg/qsvggenerator.cpp @@ -362,7 +362,7 @@ public: translate_dashPattern(spen.dashPattern(), penWidth, &dashPattern); // SVG uses absolute offset - dashOffset = QString::fromLatin1("%1").arg(spen.dashOffset() * penWidth); + dashOffset = QString::number(spen.dashOffset() * penWidth); d_func()->attributes.stroke = color; d_func()->attributes.strokeOpacity = colorOpacity; @@ -403,8 +403,8 @@ public: } switch (spen.joinStyle()) { case Qt::MiterJoin: - stream() << "stroke-linejoin=\"miter\" "; - stream() << "stroke-miterlimit=\""<<spen.miterLimit()<<"\" "; + stream() << "stroke-linejoin=\"miter\" " + "stroke-miterlimit=\""<<spen.miterLimit()<<"\" "; break; case Qt::BevelJoin: stream() << "stroke-linejoin=\"bevel\" "; @@ -413,8 +413,8 @@ public: stream() << "stroke-linejoin=\"round\" "; break; case Qt::SvgMiterJoin: - stream() << "stroke-linejoin=\"miter\" "; - stream() << "stroke-miterlimit=\""<<spen.miterLimit()<<"\" "; + stream() << "stroke-linejoin=\"miter\" " + "stroke-miterlimit=\""<<spen.miterLimit()<<"\" "; break; default: qWarning("Unhandled join style"); @@ -427,8 +427,8 @@ public: case Qt::SolidPattern: { QString color, colorOpacity; translate_color(sbrush.color(), &color, &colorOpacity); - stream() << "fill=\"" << color << "\" "; - stream() << "fill-opacity=\"" + stream() << "fill=\"" << color << "\" " + "fill-opacity=\"" << colorOpacity << "\" "; d_func()->attributes.fill = color; d_func()->attributes.fillOpacity = colorOpacity; @@ -493,9 +493,9 @@ public: d->attributes.font_style = d->font.italic() ? QLatin1String("italic") : QLatin1String("normal"); *d->stream << "font-family=\"" << d->attributes.font_family << "\" " - << "font-size=\"" << d->attributes.font_size << "\" " - << "font-weight=\"" << d->attributes.font_weight << "\" " - << "font-style=\"" << d->attributes.font_style << "\" " + "font-size=\"" << d->attributes.font_size << "\" " + "font-weight=\"" << d->attributes.font_weight << "\" " + "font-style=\"" << d->attributes.font_style << "\" " << endl; } }; @@ -849,13 +849,13 @@ bool QSvgPaintEngine::begin(QPaintDevice *) } if (d->viewBox.isValid()) { - *d->stream << " viewBox=\"" << d->viewBox.left() << " " << d->viewBox.top(); - *d->stream << " " << d->viewBox.width() << " " << d->viewBox.height() << "\"" << endl; + *d->stream << " viewBox=\"" << d->viewBox.left() << ' ' << d->viewBox.top(); + *d->stream << ' ' << d->viewBox.width() << ' ' << d->viewBox.height() << '\"' << endl; } *d->stream << " xmlns=\"http://www.w3.org/2000/svg\"" - << " xmlns:xlink=\"http://www.w3.org/1999/xlink\" " - << " version=\"1.2\" baseProfile=\"tiny\">" << endl; + " xmlns:xlink=\"http://www.w3.org/1999/xlink\" " + " version=\"1.2\" baseProfile=\"tiny\">" << endl; if (!d->attributes.document_title.isEmpty()) { *d->stream << "<title>" << d->attributes.document_title << "</title>" << endl; @@ -918,10 +918,10 @@ void QSvgPaintEngine::drawImage(const QRectF &r, const QImage &image, Q_UNUSED(sr); Q_UNUSED(flags); stream() << "<image "; - stream() << "x=\""<<r.x()<<"\" "; - stream() << "y=\""<<r.y()<<"\" "; - stream() << "width=\""<<r.width()<<"\" "; - stream() << "height=\""<<r.height()<<"\" "; + stream() << "x=\""<<r.x()<<"\" " + "y=\""<<r.y()<<"\" " + "width=\""<<r.width()<<"\" " + "height=\""<<r.height()<<"\" "; QByteArray data; QBuffer buffer(&data); @@ -930,8 +930,7 @@ void QSvgPaintEngine::drawImage(const QRectF &r, const QImage &image, buffer.close(); stream() << "xlink:href=\"data:image/png;base64," << data.toBase64() - <<"\" "; - stream() << "/>\n"; + <<"\" />\n"; } void QSvgPaintEngine::updateState(const QPaintEngineState &state) @@ -958,10 +957,10 @@ void QSvgPaintEngine::updateState(const QPaintEngineState &state) if (flags & QPaintEngine::DirtyTransform) { d->matrix = state.matrix(); - *d->stream << "transform=\"matrix(" << d->matrix.m11() << "," - << d->matrix.m12() << "," - << d->matrix.m21() << "," << d->matrix.m22() << "," - << d->matrix.dx() << "," << d->matrix.dy() + *d->stream << "transform=\"matrix(" << d->matrix.m11() << ',' + << d->matrix.m12() << ',' + << d->matrix.m21() << ',' << d->matrix.m22() << ',' + << d->matrix.dx() << ',' << d->matrix.dy() << ")\"" << endl; } @@ -975,7 +974,7 @@ void QSvgPaintEngine::updateState(const QPaintEngineState &state) stream() << "opacity=\""<<state.opacity()<<"\" "; } - *d->stream << ">" << endl; + *d->stream << '>' << endl; d->afterFirstUpdate = true; } @@ -984,10 +983,8 @@ void QSvgPaintEngine::drawPath(const QPainterPath &p) { Q_D(QSvgPaintEngine); - *d->stream << "<path "; - - - *d->stream << "fill-rule="; + *d->stream << "<path " + "fill-rule="; if (p.fillRule() == Qt::OddEvenFill) *d->stream << "\"evenodd\" "; else @@ -999,13 +996,13 @@ void QSvgPaintEngine::drawPath(const QPainterPath &p) const QPainterPath::Element &e = p.elementAt(i); switch (e.type) { case QPainterPath::MoveToElement: - *d->stream << "M" << e.x << "," << e.y; + *d->stream << 'M' << e.x << ',' << e.y; break; case QPainterPath::LineToElement: - *d->stream << "L" << e.x << "," << e.y; + *d->stream << 'L' << e.x << ',' << e.y; break; case QPainterPath::CurveToElement: - *d->stream << "C" << e.x << "," << e.y; + *d->stream << 'C' << e.x << ',' << e.y; ++i; while (i < p.elementCount()) { const QPainterPath::Element &e = p.elementAt(i); @@ -1013,8 +1010,8 @@ void QSvgPaintEngine::drawPath(const QPainterPath &p) --i; break; } else - *d->stream << " "; - *d->stream << e.x << "," << e.y; + *d->stream << ' '; + *d->stream << e.x << ',' << e.y; ++i; } break; @@ -1022,7 +1019,7 @@ void QSvgPaintEngine::drawPath(const QPainterPath &p) break; } if (i != p.elementCount() - 1) { - *d->stream << " "; + *d->stream << ' '; } } @@ -1044,7 +1041,7 @@ void QSvgPaintEngine::drawPolygon(const QPointF *points, int pointCount, stream() << "<polyline fill=\"none\" points=\""; for (int i = 0; i < pointCount; ++i) { const QPointF &pt = points[i]; - stream() << pt.x() << "," << pt.y() << " "; + stream() << pt.x() << ',' << pt.y() << ' '; } stream() << "\" />" <<endl; } else { @@ -1063,10 +1060,10 @@ void QSvgPaintEngine::drawTextItem(const QPointF &pt, const QTextItem &textItem) QString s = QString::fromRawData(ti.chars, ti.num_chars); *d->stream << "<text " - << "fill=\"" << d->attributes.stroke << "\" " - << "fill-opacity=\"" << d->attributes.strokeOpacity << "\" " - << "stroke=\"none\" " - << "x=\"" << pt.x() << "\" y=\"" << pt.y() << "\" "; + "fill=\"" << d->attributes.stroke << "\" " + "fill-opacity=\"" << d->attributes.strokeOpacity << "\" " + "stroke=\"none\" " + "x=\"" << pt.x() << "\" y=\"" << pt.y() << "\" "; qfontToSvg(textItem.font()); *d->stream << " >" << Qt::escape(s) diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h index 8bb6e84..b6340f8 100644 --- a/src/testlib/qbenchmark_p.h +++ b/src/testlib/qbenchmark_p.h @@ -81,7 +81,7 @@ struct QBenchmarkContext QString toString() const { - QString s = QString(QLatin1String("%1,%2,%3")).arg(slotName).arg(tag).arg(checkpointIndex); + QString s = QString::fromLatin1("%1,%2,%3").arg(slotName).arg(tag).arg(checkpointIndex); return s; } diff --git a/src/testlib/qbenchmarkvalgrind.cpp b/src/testlib/qbenchmarkvalgrind.cpp index bcce147..c61460d 100644 --- a/src/testlib/qbenchmarkvalgrind.cpp +++ b/src/testlib/qbenchmarkvalgrind.cpp @@ -133,12 +133,12 @@ QString QBenchmarkValgrindUtils::getNewestFileName() QString base = QBenchmarkGlobalData::current->callgrindOutFileBase; Q_ASSERT(!base.isEmpty()); - nameFilters << QString(QLatin1String("%1.*")).arg(base); + nameFilters << QString::fromLatin1("%1.*").arg(base); QFileInfoList fiList = QDir().entryInfoList(nameFilters, QDir::Files | QDir::Readable); Q_ASSERT(!fiList.empty()); int hiSuffix = -1; QFileInfo lastFileInfo; - const QString pattern = QString(QLatin1String("%1.(\\d+)")).arg(base); + const QString pattern = QString::fromLatin1("%1.(\\d+)").arg(base); const QRegExp rx(pattern); foreach (QFileInfo fileInfo, fiList) { const int index = rx.indexIn(fileInfo.fileName()); @@ -168,8 +168,8 @@ void QBenchmarkValgrindUtils::cleanup() QString base = QBenchmarkGlobalData::current->callgrindOutFileBase; Q_ASSERT(!base.isEmpty()); nameFilters - << QString(QLatin1String("%1")).arg(base) // overall summary - << QString(QLatin1String("%1.*")).arg(base); // individual dumps + << base // overall summary + << QString::fromLatin1("%1.*").arg(base); // individual dumps QFileInfoList fiList = QDir().entryInfoList(nameFilters, QDir::Files | QDir::Readable); foreach (QFileInfo fileInfo, fiList) { const bool removeOk = QFile::remove(fileInfo.fileName()); @@ -180,7 +180,7 @@ void QBenchmarkValgrindUtils::cleanup() QString QBenchmarkValgrindUtils::outFileBase(qint64 pid) { - return QString(QLatin1String("callgrind.out.%1")).arg( + return QString::fromLatin1("callgrind.out.%1").arg( pid != -1 ? pid : QCoreApplication::applicationPid()); } diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index 6f10d72..8ffdca2 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -216,9 +216,9 @@ namespace QTest { template <typename T> QString formatResult(T number, int significantDigits) { if (number < T(0)) - return QString(QLatin1String("NAN")); + return QLatin1String("NAN"); if (number == T(0)) - return QString(QLatin1String("0")); + return QLatin1String("0"); QString beforeDecimalPoint = QString::number(qint64(number), 'f', 0); QString afterDecimalPoint = QString::number(number, 'f', 20); diff --git a/src/testlib/qsignaldumper.cpp b/src/testlib/qsignaldumper.cpp index 0a32a6d..3a9d75e 100644 --- a/src/testlib/qsignaldumper.cpp +++ b/src/testlib/qsignaldumper.cpp @@ -87,7 +87,7 @@ static void qSignalDumperCallback(QObject *caller, int method_index, void **argv str.fill(' ', QTest::iLevel++ * QTest::IndentSpacesCount); str += "Signal: "; str += mo->className(); - str += "("; + str += '('; QString objname = caller->objectName(); str += objname.toLocal8Bit(); @@ -114,15 +114,15 @@ static void qSignalDumperCallback(QObject *caller, int method_index, void **argv str.append(QByteArray::number(addr, 16)); } else if (typeId != QMetaType::Void) { str.append(arg) - .append("(") + .append('(') .append(QVariant(typeId, argv[i + 1]).toString().toLocal8Bit()) - .append(")"); + .append(')'); } str.append(", "); } if (str.endsWith(", ")) str.chop(2); - str.append(")"); + str.append(')'); qPrintMessage(str); } @@ -143,7 +143,7 @@ static void qSignalDumperCallbackSlot(QObject *caller, int method_index, void ** str.fill(' ', QTest::iLevel * QTest::IndentSpacesCount); str += "Slot: "; str += mo->className(); - str += "("; + str += '('; QString objname = caller->objectName(); str += objname.toLocal8Bit(); diff --git a/src/tools/idc/main.cpp b/src/tools/idc/main.cpp index eb04114..8d2f0cc 100644 --- a/src/tools/idc/main.cpp +++ b/src/tools/idc/main.cpp @@ -50,8 +50,8 @@ QT_BEGIN_NAMESPACE static QString quotePath(const QString &s) { - if (!s.startsWith(QLatin1String("\"")) && s.contains(QLatin1Char(' '))) - return QLatin1String("\"") + s + QLatin1String("\""); + if (!s.startsWith(QLatin1Char('\"')) && s.contains(QLatin1Char(' '))) + return QLatin1Char('\"') + s + QLatin1Char('\"'); return s; } @@ -282,7 +282,7 @@ int runIdc(int argc, char **argv) fprintf(stderr, "Server unregistered successfully!\n"); return 0; } else if (p[0] == QLatin1Char('/') || p[0] == QLatin1Char('-')) { - error = QLatin1String("Unknown option \"") + p + QLatin1String("\""); + error = QLatin1String("Unknown option \"") + p + QLatin1Char('\"'); break; } else { input = QLatin1String(argv[i]); diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index ae8a76e..e94bb77 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -1161,8 +1161,8 @@ void Generator::_generateFunctions(QList<FunctionDef> &list, int type) for (int j = 0; j < f.arguments.count(); ++j) { const ArgumentDef &a = f.arguments.at(j); if (j) { - sig += ","; - arguments += ","; + sig += ','; + arguments += ','; } sig += a.normalizedType; arguments += a.name; diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index a6a0ba1..8ca2823 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -752,14 +752,14 @@ void Moc::generate(FILE *out) if (!noInclude) { - if (includePath.size() && includePath.right(1) != "/") - includePath += "/"; + if (includePath.size() && !includePath.endsWith('/')) + includePath += '/'; for (int i = 0; i < includeFiles.size(); ++i) { QByteArray inc = includeFiles.at(i); if (inc[0] != '<' && inc[0] != '"') { if (includePath.size() && includePath != "./") inc.prepend(includePath); - inc = "\"" + inc + "\""; + inc = '\"' + inc + '\"'; } fprintf(out, "#include %s\n", inc.constData()); } diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index 45cbbfd..3260ca2 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -807,7 +807,7 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed) continue; QByteArray frameworkCandidate = include.left(slashPos); frameworkCandidate.append(".framework/Headers/"); - fi.setFile(QString::fromLocal8Bit(p.path + "/" + frameworkCandidate), QString::fromLocal8Bit(include.mid(slashPos + 1))); + fi.setFile(QString::fromLocal8Bit(p.path + '/' + frameworkCandidate), QString::fromLocal8Bit(include.mid(slashPos + 1))); } else { fi.setFile(QString::fromLocal8Bit(p.path), QString::fromLocal8Bit(include)); } diff --git a/src/tools/uic/cpp/cppwriteicondata.cpp b/src/tools/uic/cpp/cppwriteicondata.cpp index 53b108f..08d552d 100644 --- a/src/tools/uic/cpp/cppwriteicondata.cpp +++ b/src/tools/uic/cpp/cppwriteicondata.cpp @@ -161,9 +161,9 @@ void WriteIconData::writeImage(QTextStream &output, const QString &indent, DomIm for (a = 0; a < (int) (data.length()/2)-1; a++) { output << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << ','; if (a % 12 == 11) - output << "\n" << indent; + output << '\n' << indent; else - output << " "; + output << ' '; } output << "0x" << QString(data[2*a]) << QString(data[2*a+1]) << '\n'; output << "};\n\n"; diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 47566ad..5a2f487 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -2813,7 +2813,7 @@ QString WriteInitialization::Item::writeSetupUi(const QString &parent, Item::Emp bool generateMultiDirective = false; if (emptyItemPolicy == Item::ConstructItemOnly && m_children.size() == 0) { if (m_setupUiData.policy == ItemData::DontGenerate) { - m_setupUiStream << m_indent << "new " << m_itemClassName << "(" << parent << ");\n"; + m_setupUiStream << m_indent << "new " << m_itemClassName << '(' << parent << ");\n"; return QString(); } else if (m_setupUiData.policy == ItemData::GenerateWithMultiDirective) { generateMultiDirective = true; @@ -2824,11 +2824,11 @@ QString WriteInitialization::Item::writeSetupUi(const QString &parent, Item::Emp generateMultiDirectiveBegin(m_setupUiStream, m_setupUiData.directives); const QString uniqueName = m_driver->unique(QLatin1String("__") + m_itemClassName.toLower()); - m_setupUiStream << m_indent << m_itemClassName << " *" << uniqueName << " = new " << m_itemClassName << "(" << parent << ");\n"; + m_setupUiStream << m_indent << m_itemClassName << " *" << uniqueName << " = new " << m_itemClassName << '(' << parent << ");\n"; if (generateMultiDirective) { m_setupUiStream << "#else\n"; - m_setupUiStream << m_indent << "new " << m_itemClassName << "(" << parent << ");\n"; + m_setupUiStream << m_indent << "new " << m_itemClassName << '(' << parent << ");\n"; generateMultiDirectiveEnd(m_setupUiStream, m_setupUiData.directives); } diff --git a/src/tools/uic3/embed.cpp b/src/tools/uic3/embed.cpp index 882328a..b406c1f 100644 --- a/src/tools/uic3/embed.cpp +++ b/src/tools/uic3/embed.cpp @@ -238,7 +238,7 @@ void Ui3Reader::embed(const char *project, const QStringList &images) out << "true, "; else out << "false, "; - out << "\"" << e->name << "\" },\n"; + out << '\"' << e->name << "\" },\n"; delete e; } #ifndef QT_NO_IMAGE_COLLECTION_COMPRESSION diff --git a/src/tools/uic3/form.cpp b/src/tools/uic3/form.cpp index d9e968b..b484210 100644 --- a/src/tools/uic3/form.cpp +++ b/src/tools/uic3/form.cpp @@ -185,14 +185,14 @@ void Ui3Reader::createFormDecl(const QDomElement &e, bool implicitIncludes) for (it = globalIncludes.constBegin(); it != globalIncludes.constEnd(); ++it) { if (!(*it).isEmpty()) { QString header = fixHeaderName(*it); - out << "#include <" << header << ">" << endl; + out << "#include <" << header << '>' << endl; } } localIncludes = unique(localIncludes); for (it = localIncludes.constBegin(); it != localIncludes.constEnd(); ++it) { if (!(*it).isEmpty()) { QString header = fixHeaderName(*it); - out << "#include \"" << header << "\"" << endl; + out << "#include \"" << header << '\"' << endl; } } out << endl; @@ -216,7 +216,7 @@ void Ui3Reader::createFormDecl(const QDomElement &e, bool implicitIncludes) typeDefs = unique(typeDefs); for (it = typeDefs.constBegin(); it != typeDefs.constEnd(); ++it) { if (!(*it).isEmpty()) - out << "typedef " << *it << ";" << endl; + out << "typedef " << *it << ';' << endl; } nl = e.parentNode().toElement().elementsByTagName(QLatin1String("forward")); @@ -236,17 +236,17 @@ void Ui3Reader::createFormDecl(const QDomElement &e, bool implicitIncludes) out << "namespace " << *ns << " {" << endl; ++ns; } - out << "class " << forwardName << ";" << endl; + out << "class " << forwardName << ';' << endl; for (int i = 0; i < (int) forwardNamespaces.count(); i++) - out << "}" << endl; + out << '}' << endl; } } for (it = forwardDecl2.constBegin(); it != forwardDecl2.constEnd(); ++it) { QString fd = *it; fd = fd.trimmed(); - if (!fd.endsWith(QLatin1String(";"))) - fd += QLatin1String(";"); + if (!fd.endsWith(QLatin1Char(';'))) + fd += QLatin1Char(';'); out << fd << endl; } @@ -279,7 +279,7 @@ void Ui3Reader::createWrapperDecl(const QDomElement &e, const QString &converted out << "#ifndef " << protector << endl; out << "#define " << protector << endl; out << endl; - out << "#include \"" << convertedUiFile << "\"" << endl; + out << "#include \"" << convertedUiFile << '\"' << endl; createWrapperDeclContents(e); out << endl; @@ -309,8 +309,8 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e) out << "class "; if (!exportMacro.isEmpty()) - out << exportMacro << " "; - out << bareNameOfClass << " : public " << objClass << ", public Ui::" << bareNameOfClass << endl << "{" << endl; + out << exportMacro << ' '; + out << bareNameOfClass << " : public " << objClass << ", public Ui::" << bareNameOfClass << endl << '{' << endl; /* qmake ignore Q_OBJECT */ out << " Q_OBJECT" << endl; @@ -362,8 +362,8 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e) continue; QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void")); QString functionName = n.firstChild().toText().data().trimmed(); - if (functionName.endsWith(QLatin1String(";"))) - functionName = functionName.left(functionName.length() - 1); + if (functionName.endsWith(QLatin1Char(';'))) + functionName.chop(1); QString specifier = n.attribute(QLatin1String("specifier")); QString access = n.attribute(QLatin1String("access")); if (access == QLatin1String(QLatin1String("protected"))) { @@ -394,8 +394,8 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e) continue; QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void")); QString functionName = n.firstChild().toText().data().trimmed(); - if (functionName.endsWith(QLatin1String(";"))) - functionName = functionName.left(functionName.length() - 1); + if (functionName.endsWith(QLatin1Char(';'))) + functionName.chop(1); QString specifier = n.attribute(QLatin1String("specifier")); QString access = n.attribute(QLatin1String("access")); if (access == QLatin1String("protected")) { @@ -423,8 +423,8 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e) // continue; QString access = n.attribute(QLatin1String("access"), QLatin1String("protected")); QString var = fixDeclaration(n.firstChild().toText().data().trimmed()); - if (!var.endsWith(QLatin1String(";"))) - var += QLatin1String(";"); + if (!var.endsWith(QLatin1Char(';'))) + var += QLatin1Char(';'); if (access == QLatin1String("public")) publicVars += var; else if (access == QLatin1String("private")) @@ -458,7 +458,7 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e) if (n.attribute(QLatin1String("language"), QLatin1String("C++")) != QLatin1String("C++")) continue; QString sigName = n.firstChild().toText().data().trimmed(); - if (sigName.endsWith(QLatin1String(";"))) + if (sigName.endsWith(QLatin1Char(';'))) sigName = sigName.left(sigName.length() - 1); extraSignals += fixDeclaration(sigName); } @@ -467,7 +467,7 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e) if (!extraSignals.isEmpty()) { out << "signals:" << endl; for (it = extraSignals.constBegin(); it != extraSignals.constEnd(); ++it) - out << " void " << (*it) << ";" << endl; + out << " void " << (*it) << ';' << endl; out << endl; } @@ -513,7 +513,7 @@ void Ui3Reader::createWrapperDeclContents(const QDomElement &e) out << "};" << endl; for (i = 0; i < (int) namespaces.count(); i++) - out << "}" << endl; + out << '}' << endl; out << endl; } @@ -543,7 +543,7 @@ void Ui3Reader::writeFunctionsDecl(const QStringList &fuLst, const QStringList & signature = fixDeclaration(signature); type = fixType(type); - out << " " << specifier << type << " " << signature << pure << ";" << endl; + out << " " << specifier << type << ' ' << signature << pure << ';' << endl; } out << endl; } @@ -583,8 +583,8 @@ void Ui3Reader::createFormImpl(const QDomElement &e) if (n.attribute(QLatin1String("language"), QLatin1String("C++")) != QLatin1String("C++")) continue; QString functionName = n.firstChild().toText().data().trimmed(); - if (functionName.endsWith(QLatin1String(";"))) - functionName = functionName.left(functionName.length() - 1); + if (functionName.endsWith(QLatin1Char(';'))) + functionName.chop(1); extraFuncts += functionName; extraFunctTyp += n.attribute(QLatin1String("returnType"), QLatin1String("void")); extraFunctSpecifier += n.attribute(QLatin1String("specifier"), QLatin1String("virtual")); @@ -598,8 +598,8 @@ void Ui3Reader::createFormImpl(const QDomElement &e) if (n.attribute(QLatin1String("language"), QLatin1String("C++")) != QLatin1String("C++")) continue; QString functionName = n.firstChild().toText().data().trimmed(); - if (functionName.endsWith(QLatin1String(";"))) - functionName = functionName.left(functionName.length() - 1); + if (functionName.endsWith(QLatin1Char(';'))) + functionName.chop(1); extraFuncts += functionName; extraFunctTyp += n.attribute(QLatin1String("returnType"), QLatin1String("void")); extraFunctSpecifier += n.attribute(QLatin1String("specifier"), QLatin1String("virtual")); @@ -663,7 +663,7 @@ void Ui3Reader::createFormImpl(const QDomElement &e) globalIncludes = unique(globalIncludes); for (it = globalIncludes.begin(); it != globalIncludes.end(); ++it) { if (!(*it).isEmpty()) - out << "#include <" << fixHeaderName(*it) << ">" << endl; + out << "#include <" << fixHeaderName(*it) << '>' << endl; } if (externPixmaps) { @@ -677,14 +677,14 @@ void Ui3Reader::createFormImpl(const QDomElement &e) localIncludes = unique(localIncludes); for (it = localIncludes.begin(); it != localIncludes.end(); ++it) { if (!(*it).isEmpty() && *it != QFileInfo(fileName + QLatin1String(".h")).fileName()) - out << "#include \"" << fixHeaderName(*it) << "\"" << endl; + out << "#include \"" << fixHeaderName(*it) << '\"' << endl; } QString uiDotH = fileName + QLatin1String(".h"); if (QFile::exists(uiDotH)) { if (!outputFileName.isEmpty()) uiDotH = QString::fromUtf8(combinePath(uiDotH.ascii(), outputFileName.ascii())); - out << "#include \"" << uiDotH << "\"" << endl; + out << "#include \"" << uiDotH << '\"' << endl; writeFunctImpl = false; } @@ -702,7 +702,7 @@ void Ui3Reader::createFormImpl(const QDomElement &e) out << " * name 'name' and widget flags set to 'f'." << endl; out << " *" << endl; out << " * The " << objClass.mid(1).toLower() << " will by default be modeless, unless you set 'modal' to" << endl; - out << " * true to construct a modal " << objClass.mid(1).toLower() << "." << endl; + out << " * true to construct a modal " << objClass.mid(1).toLower() << '.' << endl; out << " */" << endl; out << nameOfClass << "::" << bareNameOfClass << "(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)" << endl; out << " : " << objClass << "(parent, name, modal, fl)"; @@ -733,7 +733,7 @@ void Ui3Reader::createFormImpl(const QDomElement &e) out << endl; - out << "{" << endl; + out << '{' << endl; // // setup the gui @@ -775,7 +775,7 @@ void Ui3Reader::createFormImpl(const QDomElement &e) out << indent << "init();" << endl; // end of constructor - out << "}" << endl; + out << '}' << endl; out << endl; // destructor @@ -783,11 +783,11 @@ void Ui3Reader::createFormImpl(const QDomElement &e) out << " * Destroys the object and frees any allocated resources" << endl; out << " */" << endl; out << nameOfClass << "::~" << bareNameOfClass << "()" << endl; - out << "{" << endl; + out << '{' << endl; if (extraFuncts.contains(QLatin1String("destroy()"))) out << indent << "destroy();" << endl; out << indent << "// no need to delete child widgets, Qt does it all for us" << endl; - out << "}" << endl; + out << '}' << endl; out << endl; // handle application events if required @@ -816,9 +816,9 @@ void Ui3Reader::createFormImpl(const QDomElement &e) out << " * language." << endl; out << " */" << endl; out << "void " << nameOfClass << "::languageChange()" << endl; - out << "{" << endl; + out << '{' << endl; out << " retranslateUi(this);" << endl; - out << "}" << endl; + out << '}' << endl; out << endl; // create stubs for additional slots if necessary @@ -833,8 +833,8 @@ void Ui3Reader::createFormImpl(const QDomElement &e) type = type.simplified(); QString fname = fixDeclaration(Parser::cleanArgs(*it)); if (!(*it3).startsWith(QLatin1String("pure"))) { // "pure virtual" or "pureVirtual" - out << type << " " << nameOfClass << "::" << fname << endl; - out << "{" << endl; + out << type << ' ' << nameOfClass << "::" << fname << endl; + out << '{' << endl; if (*it != QLatin1String("init()") && *it != QLatin1String("destroy()")) { QRegExp numeric(QLatin1String("^(?:signed|unsigned|u?char|u?short|u?int" "|u?long|Q_U?INT(?:8|16|32)|Q_U?LONG|float" @@ -868,14 +868,14 @@ void Ui3Reader::createFormImpl(const QDomElement &e) if (type == QLatin1String("bool")) { retVal = QLatin1String("false"); - } else if (isBasicNumericType || type.endsWith(QLatin1String("*"))) { + } else if (isBasicNumericType || type.endsWith(QLatin1Char('*'))) { retVal = QLatin1String("0"); - } else if (type.endsWith(QLatin1String("&"))) { + } else if (type.endsWith(QLatin1Char('&'))) { do { type.chop(1); - } while (type.endsWith(QLatin1String(" "))); + } while (type.endsWith(QLatin1Char(' '))); retVal = QLatin1String("uic_temp_var"); - out << indent << "static " << type << " " << retVal << ";" << endl; + out << indent << "static " << type << ' ' << retVal << ';' << endl; } else { retVal = type + QLatin1String("()"); } @@ -883,9 +883,9 @@ void Ui3Reader::createFormImpl(const QDomElement &e) out << indent << "qWarning(\"" << nameOfClass << "::" << fname << ": Not implemented yet\");" << endl; if (!retVal.isEmpty()) - out << indent << "return " << retVal << ";" << endl; + out << indent << "return " << retVal << ';' << endl; } - out << "}" << endl; + out << '}' << endl; out << endl; } ++it; diff --git a/src/tools/uic3/main.cpp b/src/tools/uic3/main.cpp index d581016..9535b91 100644 --- a/src/tools/uic3/main.cpp +++ b/src/tools/uic3/main.cpp @@ -367,7 +367,7 @@ int runUic3(int argc, char * argv[]) } if (headerFile) { - out << "#include \"" << headerFile << "\"" << endl << endl; + out << "#include \"" << headerFile << '\"' << endl << endl; } QString convertedUi; diff --git a/src/tools/uic3/parser.cpp b/src/tools/uic3/parser.cpp index 744dd30..395cc4d 100644 --- a/src/tools/uic3/parser.cpp +++ b/src/tools/uic3/parser.cpp @@ -48,14 +48,14 @@ QT_BEGIN_NAMESPACE QString Parser::cleanArgs(const QString &func) { QString slot(func); - int begin = slot.indexOf(QLatin1String("(")) + 1; + int begin = slot.indexOf(QLatin1Char('(')) + 1; QString args = slot.mid(begin); - args = args.left(args.indexOf(QLatin1String(")"))); + args = args.left(args.indexOf(QLatin1Char(')'))); QStringList lst = args.split(QLatin1Char(',')); QString res = slot.left(begin); for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it) { if (it != lst.begin()) - res += QLatin1String(","); + res += QLatin1Char(','); QString arg = *it; int pos = 0; if ((pos = arg.indexOf(QLatin1Char('&'))) != -1) { @@ -65,7 +65,7 @@ QString Parser::cleanArgs(const QString &func) } else { arg = arg.simplified(); if ((pos = arg.indexOf(QLatin1Char(':'))) != -1) - arg = arg.left(pos).simplified() + QLatin1String(":") + arg.mid(pos + 1).simplified(); + arg = arg.left(pos).simplified() + QLatin1Char(':') + arg.mid(pos + 1).simplified(); QStringList l = arg.split(QLatin1Char(' ')); if (l.count() == 2) { if (l[0] != QLatin1String("const") @@ -73,12 +73,12 @@ QString Parser::cleanArgs(const QString &func) && l[0] != QLatin1String("var")) arg = l[0]; } else if (l.count() == 3) { - arg = l[0] + QLatin1String(" ") + l[1]; + arg = l[0] + QLatin1Char(' ') + l[1]; } } res += arg; } - res += QLatin1String(")"); + res += QLatin1Char(')'); return res; } diff --git a/src/tools/uic3/qt3to4.cpp b/src/tools/uic3/qt3to4.cpp index 9e5b64b..2862727 100644 --- a/src/tools/uic3/qt3to4.cpp +++ b/src/tools/uic3/qt3to4.cpp @@ -149,7 +149,7 @@ void Porting::readXML(RuleList *renamedHeaders, RuleList *renamedClasses, RuleLi QString fileName = QLatin1String("q3porting.xml"); QString filePath; //check QLibraryInfo::DataPath/filename - filePath = QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::DataPath) + QLatin1String("/") + fileName) ; + filePath = QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::DataPath) + QLatin1Char('/') + fileName) ; //check QLibraryInfo::PrefixPath/tools/porting/src/filename if (!QFile::exists(filePath)) diff --git a/src/tools/uic3/subclassing.cpp b/src/tools/uic3/subclassing.cpp index e590ab7..85c2218 100644 --- a/src/tools/uic3/subclassing.cpp +++ b/src/tools/uic3/subclassing.cpp @@ -69,7 +69,7 @@ void Ui3Reader::createSubDecl( const QDomElement &e, const QString& subClass ) return; out << "class " << subClass << " : public " << nameOfClass << endl; - out << "{" << endl; + out << '{' << endl; /* tmake ignore Q_OBJECT */ out << " Q_OBJECT" << endl; @@ -105,8 +105,8 @@ void Ui3Reader::createSubDecl( const QDomElement &e, const QString& subClass ) continue; QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void")); QString functionName = n.firstChild().toText().data().trimmed(); - if ( functionName.endsWith(QLatin1String(";"))) - functionName = functionName.left( functionName.length() - 1 ); + if ( functionName.endsWith(QLatin1Char(';'))) + functionName.chop(1); QString specifier = n.attribute(QLatin1String("specifier")); QString access = n.attribute(QLatin1String("access")); if ( access == QLatin1String("protected") ) { @@ -133,8 +133,8 @@ void Ui3Reader::createSubDecl( const QDomElement &e, const QString& subClass ) continue; QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void")); QString functionName = n.firstChild().toText().data().trimmed(); - if ( functionName.endsWith(QLatin1String(";")) ) - functionName = functionName.left( functionName.length() - 1 ); + if ( functionName.endsWith(QLatin1Char(';')) ) + functionName.chop(1); QString specifier = n.attribute(QLatin1String("specifier")); QString access = n.attribute(QLatin1String("access")); if ( access == QLatin1String("protected") ) { @@ -195,7 +195,7 @@ void Ui3Reader::writeFunctionsSubDecl( const QStringList &fuLst, const QStringLi type = QLatin1String("void"); if ( *it3 == QLatin1String("non virtual") ) continue; - out << " " << type << " " << fixDeclaration(*it) << ";" << endl; + out << " " << type << ' ' << fixDeclaration(*it) << ';' << endl; } out << endl; } @@ -223,7 +223,7 @@ void Ui3Reader::createSubImpl( const QDomElement &e, const QString& subClass ) out << " * name 'name' and widget flags set to 'f' " << endl; out << " *" << endl; out << " * The " << objClass.mid(1).toLower() << " will by default be modeless, unless you set 'modal' to" << endl; - out << " * true to construct a modal " << objClass.mid(1).toLower() << "." << endl; + out << " * true to construct a modal " << objClass.mid(1).toLower() << '.' << endl; out << " */" << endl; out << subClass << "::" << subClass << "( QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl )" << endl; out << " : " << nameOfClass << "( parent, name, modal, fl )" << endl; @@ -235,8 +235,8 @@ void Ui3Reader::createSubImpl( const QDomElement &e, const QString& subClass ) out << subClass << "::" << subClass << "( QWidget* parent, const char* name, Qt::WindowFlags fl )" << endl; out << " : " << nameOfClass << "( parent, name, fl )" << endl; } - out << "{" << endl; - out << "}" << endl; + out << '{' << endl; + out << '}' << endl; out << endl; // destructor @@ -244,9 +244,9 @@ void Ui3Reader::createSubImpl( const QDomElement &e, const QString& subClass ) out << " * Destroys the object and frees any allocated resources" << endl; out << " */" << endl; out << subClass << "::~" << subClass << "()" << endl; - out << "{" << endl; + out << '{' << endl; out << " // no need to delete child widgets, Qt does it all for us" << endl; - out << "}" << endl; + out << '}' << endl; out << endl; @@ -268,8 +268,8 @@ void Ui3Reader::createSubImpl( const QDomElement &e, const QString& subClass ) continue; QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void")); QString functionName = n.firstChild().toText().data().trimmed(); - if ( functionName.endsWith(QLatin1String(";")) ) - functionName = functionName.left( functionName.length() - 1 ); + if ( functionName.endsWith(QLatin1Char(';')) ) + functionName.chop(1); QString specifier = n.attribute(QLatin1String("specifier")); QString access = n.attribute(QLatin1String("access")); if ( access == QLatin1String("protected") ) { @@ -296,8 +296,8 @@ void Ui3Reader::createSubImpl( const QDomElement &e, const QString& subClass ) continue; QString returnType = n.attribute(QLatin1String("returnType"), QLatin1String("void")); QString functionName = n.firstChild().toText().data().trimmed(); - if ( functionName.endsWith(QLatin1String(";")) ) - functionName = functionName.left( functionName.length() - 1 ); + if ( functionName.endsWith(QLatin1Char(';')) ) + functionName.chop(1); QString specifier = n.attribute(QLatin1String("specifier")); QString access = n.attribute(QLatin1String("access")); if ( access == QLatin1String("protected") ) { @@ -351,10 +351,10 @@ void Ui3Reader::writeFunctionsSubImpl( const QStringList &fuLst, const QStringLi out << "/*" << endl; out << " * " << descr << endl; out << " */" << endl; - out << type << " " << subClass << "::" << fixDeclaration(*it) << endl; - out << "{" << endl; + out << type << ' ' << subClass << "::" << fixDeclaration(*it) << endl; + out << '{' << endl; out << " qWarning( \"" << subClass << "::" << fixDeclaration(*it) << " not yet implemented!\" );" << endl; - out << "}" << endl << endl; + out << '}' << endl << endl; } out << endl; } diff --git a/src/tools/uic3/ui3reader.cpp b/src/tools/uic3/ui3reader.cpp index 1ba4b2f..539565c 100644 --- a/src/tools/uic3/ui3reader.cpp +++ b/src/tools/uic3/ui3reader.cpp @@ -125,10 +125,10 @@ QString Ui3Reader::fixString(const QString &str, bool encode) QString s; if (!encode) { s = str; - s.replace(QLatin1String("\\"), QLatin1String("\\\\")); - s.replace(QLatin1String("\""), QLatin1String("\\\"")); - s.replace(QLatin1String("\r"), QLatin1String("")); - s.replace(QLatin1String("\n"), QLatin1String("\\n\"\n\"")); + s.replace(QLatin1Char('\\'), QLatin1String("\\\\")); + s.replace(QLatin1Char('\"'), QLatin1String("\\\"")); + s.remove(QLatin1Char('\r')); + s.replace(QLatin1Char('\n'), QLatin1String("\\n\"\n\"")); } else { QByteArray utf8 = str.utf8(); const int l = utf8.length(); @@ -136,7 +136,7 @@ QString Ui3Reader::fixString(const QString &str, bool encode) s += QLatin1String("\\x") + QString::number((uchar)utf8[i], 16); } - return QLatin1String("\"") + s + QLatin1String("\""); + return QLatin1Char('\"') + s + QLatin1Char('\"'); } QString Ui3Reader::trcall(const QString& sourceText, const QString& comment) @@ -158,12 +158,12 @@ QString Ui3Reader::trcall(const QString& sourceText, const QString& comment) } if (comment.isEmpty()) { - return t + QLatin1String("(") + fixString(sourceText, encode) + QLatin1String(")"); + return t + QLatin1Char('(') + fixString(sourceText, encode) + QLatin1Char(')'); } else { - return t + QLatin1String("(") + return t + QLatin1Char('(') + fixString(sourceText, encode) + QLatin1String(", ") - + fixString(comment, encode) + QLatin1String(")"); + + fixString(comment, encode) + QLatin1Char(')'); } } @@ -480,10 +480,10 @@ void Ui3Reader::createColorGroupImpl(const QString& name, const QDomElement& e) QString pixmap = n.firstChild().toText().data(); if (!pixmapLoaderFunction.isEmpty()) { pixmap.prepend(pixmapLoaderFunction - + QLatin1String("(") + + QLatin1Char('(') + QLatin1String(externPixmaps ? "\"" : "")); - pixmap.append(QLatin1String(externPixmaps ? "\"" : "") + QLatin1String(")")); + pixmap.append(QLatin1String(externPixmaps ? "\"" : "") + QLatin1Char(')')); } out << indent << name << ".setBrush(QColorGroup::" << ColorRole[r] << ", QBrush(" << color << ", " << pixmap << "));" << endl; @@ -578,9 +578,9 @@ QString Ui3Reader::registerObject(const QString& name) if (objectNames.contains(result)) { int i = 2; - while (objectNames.contains(result + QLatin1String("_") + QString::number(i))) + while (objectNames.contains(result + QLatin1Char('_') + QString::number(i))) i++; - result += QLatin1String("_"); + result += QLatin1Char('_'); result += QString::number(i); } objectNames += result; diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp index a3bc0e0..b83b324 100644 --- a/src/winmain/qtmain_win.cpp +++ b/src/winmain/qtmain_win.cpp @@ -100,7 +100,7 @@ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR /*cmdPara #if defined(Q_OS_WINCE) TCHAR appName[256]; GetModuleFileName(0, appName, 255); - cmdParam = QString(QLatin1String("\"%1\" ")).arg(QString::fromUtf16((const unsigned short *)appName)).toLocal8Bit() + cmdParam; + cmdParam.prepend(QString::fromLatin1("\"%1\" ").arg(QString::fromUtf16((const unsigned short *)appName)).toLocal8Bit()); #endif int argc = 0; @@ -110,7 +110,7 @@ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR /*cmdPara #if defined(Q_OS_WINCE) TCHAR uniqueAppID[256]; GetModuleFileName(0, uniqueAppID, 255); - QString uid = QString::fromUtf16((const unsigned short *)uniqueAppID).toLower().replace(QString(QLatin1String("\\")), QString(QLatin1String("_"))); + QString uid = QString::frosmUtf16((const unsigned short *)uniqueAppID).toLower().replace(QLatin1Char('\\'), QLatin1Char('_')); // If there exists an other instance of this application // it will be the owner of a mutex with the unique ID. diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index dc6ff92..da0e31b 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -4589,7 +4589,7 @@ void QDomElementPrivate::save(QTextStream& s, int depth, int indent) const qName = prefix + QLatin1Char(':') + name; nsDecl = QLatin1String(" xmlns:") + prefix; } - nsDecl += QLatin1String("=\"") + encodeText(namespaceURI, s) + QLatin1String("\""); + nsDecl += QLatin1String("=\"") + encodeText(namespaceURI, s) + QLatin1Char('\"'); } s << '<' << qName << nsDecl; diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index ade0339..db50f01 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -5464,7 +5464,7 @@ bool QXmlSimpleReaderPrivate::parsePEReference() if (skipIt) { if (contentHnd) { - if (!contentHnd->skippedEntity(QString::fromLatin1("%") + ref())) { + if (!contentHnd->skippedEntity(QLatin1Char('%') + ref())) { reportParseError(contentHnd->errorString()); return false; } @@ -5476,7 +5476,7 @@ bool QXmlSimpleReaderPrivate::parsePEReference() return false; } else if (parsePEReference_context == InDTD) { // Included as PE - if (!insertXmlRef(QString::fromLatin1(" ")+xmlRefString+QString::fromLatin1(" "), ref(), false)) + if (!insertXmlRef(QLatin1Char(' ') + xmlRefString + QLatin1Char(' '), ref(), false)) return false; } } @@ -6728,7 +6728,7 @@ bool QXmlSimpleReaderPrivate::parseEntityDecl() if ( !entityExist(name())) { parameterEntities.insert(name(), string()); if (declHnd) { - if (!declHnd->internalEntityDecl(QString::fromLatin1("%")+name(), string())) { + if (!declHnd->internalEntityDecl(QLatin1Char('%') + name(), string())) { reportParseError(declHnd->errorString()); return false; } @@ -6740,7 +6740,7 @@ bool QXmlSimpleReaderPrivate::parseEntityDecl() if ( !entityExist(name())) { externParameterEntities.insert(name(), QXmlSimpleReaderPrivate::ExternParameterEntity(publicId, systemId)); if (declHnd) { - if (!declHnd->externalEntityDecl(QString::fromLatin1("%")+name(), publicId, systemId)) { + if (!declHnd->externalEntityDecl(QLatin1Char('%') + name(), publicId, systemId)) { reportParseError(declHnd->errorString()); return false; } @@ -7864,8 +7864,8 @@ bool QXmlSimpleReaderPrivate::insertXmlRef(const QString &data, const QString &n { if (inLiteral) { QString tmp = data; - xmlRefStack.push(XmlRef(name, tmp.replace(QLatin1String("\""), - QLatin1String(""")).replace(QLatin1String("'"), QLatin1String("'")))); + xmlRefStack.push(XmlRef(name, tmp.replace(QLatin1Char('\"'), + QLatin1String(""")).replace(QLatin1Char('\''), QLatin1String("'")))); } else { xmlRefStack.push(XmlRef(name, data)); } diff --git a/src/xmlpatterns/acceltree/qacceltree.cpp b/src/xmlpatterns/acceltree/qacceltree.cpp index 60e6e27..6bc1794 100644 --- a/src/xmlpatterns/acceltree/qacceltree.cpp +++ b/src/xmlpatterns/acceltree/qacceltree.cpp @@ -71,7 +71,7 @@ void AccelTree::printStats(const NamePool::Ptr &np) const for(int i = 0; i < len; ++i) { const BasicNodeData &v = basicData.at(i); - pDebug() << "|" << i + pDebug() << '|' << i << "\t\t|" << v.depth() << "\t|" << v.size() << "\t|" << postNumber(i) @@ -81,12 +81,12 @@ void AccelTree::printStats(const NamePool::Ptr &np) const : data.value(i)) << "\t|"; /* - pDebug() << "|" << QString().arg(i, 14) - << "|" << QString().arg(v.depth(), 6) - << "|" << QString().arg(v.size(), 6) - << "|" << QString().arg(postNumber(i), 14) - << "|" << QString().arg(v.kind(), 6) - << "|"; + pDebug() << '|' << QString().arg(i, 14) + << '|' << QString().arg(v.depth(), 6) + << '|' << QString().arg(v.size(), 6) + << '|' << QString().arg(postNumber(i), 14) + << '|' << QString().arg(v.kind(), 6) + << '|'; */ } pDebug() << "+---------------+-------+-------+---------------+-------+--------------+"; diff --git a/src/xmlpatterns/api/qsourcelocation.cpp b/src/xmlpatterns/api/qsourcelocation.cpp index 4eee39c..1dd8ffd 100644 --- a/src/xmlpatterns/api/qsourcelocation.cpp +++ b/src/xmlpatterns/api/qsourcelocation.cpp @@ -206,7 +206,7 @@ QDebug operator<<(QDebug debug, const QSourceLocation &sourceLocation) << sourceLocation.line() << ", column:" << sourceLocation.column() - << ")"; + << ')'; return debug; } #endif diff --git a/src/xmlpatterns/data/qabstractfloat.cpp b/src/xmlpatterns/data/qabstractfloat.cpp index b6226b5..a45b0fd 100644 --- a/src/xmlpatterns/data/qabstractfloat.cpp +++ b/src/xmlpatterns/data/qabstractfloat.cpp @@ -186,7 +186,7 @@ QString AbstractFloat<isDouble>::stringValue() const if(sign) valueAsString += QLatin1Char('-'); - valueAsString += qret.left(1); + valueAsString += qret.at(0); valueAsString += QLatin1Char('.'); if(1 == qret.size()) diff --git a/src/xmlpatterns/data/qcommonvalues.cpp b/src/xmlpatterns/data/qcommonvalues.cpp index 07a273d..99a8086 100644 --- a/src/xmlpatterns/data/qcommonvalues.cpp +++ b/src/xmlpatterns/data/qcommonvalues.cpp @@ -57,7 +57,7 @@ using namespace QPatternist; // STATIC DATA const AtomicString::Ptr CommonValues::EmptyString - (new AtomicString(QString(QLatin1String("")))); + (new AtomicString(QLatin1String(""))); const AtomicString::Ptr CommonValues::TrueString (new AtomicString(QLatin1String("true"))); const AtomicString::Ptr CommonValues::FalseString diff --git a/src/xmlpatterns/expr/qexpression_p.h b/src/xmlpatterns/expr/qexpression_p.h index 5eb63de..65918e6 100644 --- a/src/xmlpatterns/expr/qexpression_p.h +++ b/src/xmlpatterns/expr/qexpression_p.h @@ -884,7 +884,7 @@ namespace QPatternist { pDebug() << "AST REWRITE:" << old.data() << "to" << New.data() << '(' << old->actualReflection() << "to" << New->actualReflection() << ", " - << old->description() << "to" << New->description() << ")"; + << old->description() << "to" << New->description() << ')'; /* The order of these two lines is significant.. */ context->addLocation(New.data(), context->locationFor(old->actualReflection())); diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index 75955ec..f63cc65 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -230,7 +230,7 @@ int main(int argc, char *argv[]) if (file.isEmpty()) file = MainWindow::defaultHelpCollectionFileName(); QString path = QFileInfo(file).path(); - path += QLatin1String("/") + indexFilesFolder(file); + path += QLatin1Char('/') + indexFilesFolder(file); QLocalSocket localSocket; localSocket.connectToServer(QString(QLatin1String("QtAssistant%1")) diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 921b8b6..f91175d 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -127,7 +127,7 @@ static Ending ending(QString str, QLocale::Language lang) switch (ch) { case 0x002e: // full stop - if (str.endsWith(QString(QLatin1String("...")))) + if (str.endsWith(QLatin1String("..."))) return End_Ellipsis; else return End_FullStop; diff --git a/tools/linguist/linguist/phrase.cpp b/tools/linguist/linguist/phrase.cpp index 300f6e8..b1f9818 100644 --- a/tools/linguist/linguist/phrase.cpp +++ b/tools/linguist/linguist/phrase.cpp @@ -152,10 +152,10 @@ bool QphHandler::startElement(const QString & /* namespaceURI */, const QString &qName, const QXmlAttributes &atts) { - if (qName == QString(QLatin1String("QPH"))) { + if (qName == QLatin1String("QPH")) { m_language = atts.value(QLatin1String("language")); m_sourceLanguage = atts.value(QLatin1String("sourcelanguage")); - } else if (qName == QString(QLatin1String("phrase"))) { + } else if (qName == QLatin1String("phrase")) { source.truncate(0); target.truncate(0); definition.truncate(0); @@ -168,13 +168,13 @@ bool QphHandler::endElement(const QString & /* namespaceURI */, const QString & /* localName */, const QString &qName) { - if (qName == QString(QLatin1String("source"))) + if (qName == QLatin1String("source")) source = accum; - else if (qName == QString(QLatin1String("target"))) + else if (qName == QLatin1String("target")) target = accum; - else if (qName == QString(QLatin1String("definition"))) + else if (qName == QLatin1String("definition")) definition = accum; - else if (qName == QString(QLatin1String("phrase"))) + else if (qName == QLatin1String("phrase")) pb->m_phrases.append(new Phrase(source, target, definition, pb)); return true; } diff --git a/tools/linguist/lupdate/merge.cpp b/tools/linguist/lupdate/merge.cpp index c4f4448..4849d6e 100644 --- a/tools/linguist/lupdate/merge.cpp +++ b/tools/linguist/lupdate/merge.cpp @@ -193,7 +193,7 @@ static QString translationAttempt(const QString &oldTranslation, */ for (k = 0; k < p; k++) { if (!met[k]) - attempt += QString(QLatin1String(" {")) + newNumbers[k] + QString(QLatin1String("?}")); + attempt += QLatin1String(" {") + newNumbers[k] + QLatin1String("?}"); } /* @@ -205,8 +205,8 @@ static QString translationAttempt(const QString &oldTranslation, for (ell = 0; ell < p; ell++) { if (k != ell && oldNumbers[k] == oldNumbers[ell] && newNumbers[k] < newNumbers[ell]) - attempt += QString(QLatin1String(" {")) + newNumbers[k] + QString(QLatin1String(" or ")) + - newNumbers[ell] + QString(QLatin1String("?}")); + attempt += QLatin1String(" {") + newNumbers[k] + QLatin1String(" or ") + + newNumbers[ell] + QLatin1String("?}"); } } return attempt; diff --git a/tools/linguist/shared/profileevaluator.cpp b/tools/linguist/shared/profileevaluator.cpp index 0be6bec..ae46ad8 100644 --- a/tools/linguist/shared/profileevaluator.cpp +++ b/tools/linguist/shared/profileevaluator.cpp @@ -894,7 +894,7 @@ QStringList ProFileEvaluator::Private::qmakeFeaturePaths() { QStringList concat; { - const QString base_concat = QDir::separator() + QString(QLatin1String("features")); + const QString base_concat = QDir::separator() + QLatin1String("features"); concat << base_concat + QDir::separator() + QLatin1String("mac"); concat << base_concat + QDir::separator() + QLatin1String("macx"); concat << base_concat + QDir::separator() + QLatin1String("unix"); @@ -903,7 +903,7 @@ QStringList ProFileEvaluator::Private::qmakeFeaturePaths() concat << base_concat + QDir::separator() + QLatin1String("qnx6"); concat << base_concat; } - const QString mkspecs_concat = QDir::separator() + QString(QLatin1String("mkspecs")); + const QString mkspecs_concat = QDir::separator() + QLatin1String("mkspecs"); QStringList feature_roots; QByteArray mkspec_path = qgetenv("QMAKEFEATURES"); if (!mkspec_path.isNull()) diff --git a/tools/linguist/shared/proparserutils.h b/tools/linguist/shared/proparserutils.h index c27c3c0..3eab43f 100644 --- a/tools/linguist/shared/proparserutils.h +++ b/tools/linguist/shared/proparserutils.h @@ -282,7 +282,7 @@ static QStringList split_value_list(const QString &vals, bool do_semicolon=false static QStringList qmake_mkspec_paths() { QStringList ret; - const QString concat = QDir::separator() + QString(QLatin1String("mkspecs")); + const QString concat = QDir::separator() + QLatin1String("mkspecs"); QByteArray qmakepath = qgetenv("QMAKEPATH"); if (!qmakepath.isEmpty()) { const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath)); diff --git a/tools/pixeltool/qpixeltool.cpp b/tools/pixeltool/qpixeltool.cpp index 6de7741..c55cbd1 100644 --- a/tools/pixeltool/qpixeltool.cpp +++ b/tools/pixeltool/qpixeltool.cpp @@ -179,13 +179,13 @@ void QPixelTool::paintEvent(QPaintEvent *) if (m_displayZoom) { render_string(&p, w, h, - QString(QLatin1String("Zoom: x%1")).arg(m_zoom), + QString::fromLatin1("Zoom: x%1").arg(m_zoom), Qt::AlignTop | Qt::AlignRight); } if (m_displayGridSize) { render_string(&p, w, h, - QString(QLatin1String("Grid size: %1")).arg(m_gridSize), + QString::fromLatin1("Grid size: %1").arg(m_gridSize), Qt::AlignBottom | Qt::AlignLeft); } diff --git a/tools/porting/src/logger.cpp b/tools/porting/src/logger.cpp index fb44de7..bbeac9c 100644 --- a/tools/porting/src/logger.cpp +++ b/tools/porting/src/logger.cpp @@ -60,8 +60,8 @@ SourcePointLogEntry::SourcePointLogEntry(QString type, QString location, QString QString SourcePointLogEntry::description() const { return QLatin1String("In file ") + file + - QLatin1String(" at line ") + QString(QLatin1String("%1")).arg(line + 1) + //line count is zero based, adjust here. - QLatin1String(" column ") + QString(QLatin1String("%1")).arg(column) + + QLatin1String(" at line ") + QString::number(line + 1) + //line count is zero based, adjust here. + QLatin1String(" column ") + QString::number(column) + QLatin1String(": ") + text ; } @@ -127,7 +127,7 @@ QStringList Logger::fullReport() commitSection(); QStringList report; report << QLatin1String("Log for qt3to4 on ") + QDateTime::currentDateTime().toString() + - QLatin1String(". Number of log entries: ") + QString(QLatin1String("%1")).arg(logEntries.size()); + QLatin1String(". Number of log entries: ") + QString::number(logEntries.size()); foreach(LogEntry *logEntry, logEntries) { report << logEntry->description(); } diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index c8488f3..aa6b454 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -751,7 +751,7 @@ void Config::load(Location location, const QString& fileName) word += QChar(c.digitValue()); SKIP_CHAR(); } - else if ((metaCharPos = QString(QLatin1String("abfnrtv")).indexOf(c)) != -1) { + else if ((metaCharPos = QString::fromLatin1("abfnrtv").indexOf(c)) != -1) { word += "\a\b\f\n\r\t\v"[metaCharPos]; SKIP_CHAR(); } diff --git a/tools/shared/qttoolbardialog/qttoolbardialog.cpp b/tools/shared/qttoolbardialog/qttoolbardialog.cpp index f15c4bc..9c54e75 100644 --- a/tools/shared/qttoolbardialog/qttoolbardialog.cpp +++ b/tools/shared/qttoolbardialog/qttoolbardialog.cpp @@ -637,10 +637,10 @@ QToolBar *QtFullToolBarManager::createToolBar(const QString &toolBarName) return 0; QToolBar *toolBar = new QToolBar(toolBarName, mainWindow()); int i = 1; - const QString prefix = QLatin1String("_Custom_Toolbar_"); - QString name = QString(QLatin1String("%1%2")).arg(prefix).arg(i); + const QString prefix = QLatin1String("_Custom_Toolbar_%1"); + QString name = prefix.arg(i); while (d_ptr->toolBarByName(name)) - name = QString(QLatin1String("%1%2")).arg(prefix).arg(++i); + name = prefix.arg(++i); toolBar->setObjectName(name); mainWindow()->addToolBar(toolBar); d_ptr->customToolBars.append(toolBar); |