diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2016-07-22 10:15:48 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-07-22 10:15:48 +0000 |
commit | 601019e3f42516b5799fe519115f8fbdf44ed18a (patch) | |
tree | d9c800ede4d8a38a73dcb0f3aea54e5954e64d54 /src/tools | |
parent | b5f18da11fb526a444d2550715d8b867b711e67a (diff) | |
parent | 782ebeada125e3d8a293c7806e34cc737c30ddda (diff) | |
download | qtbase-601019e3f42516b5799fe519115f8fbdf44ed18a.tar.gz |
Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/preprocessor.cpp | 8 | ||||
-rw-r--r-- | src/tools/uic/cpp/cppwriteincludes.cpp | 3 | ||||
-rw-r--r-- | src/tools/uic/cpp/cppwriteinitialization.cpp | 84 |
3 files changed, 42 insertions, 53 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index b9359ff3f4..415003e6b1 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -188,7 +188,8 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso token = keywords[state].ident; if (token == NOTOKEN) { - ++data; + if (*data) + ++data; // an error really, but let's ignore this input // to not confuse moc later. However in pre-processor // only mode let's continue. @@ -362,7 +363,6 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso ++data; continue; } - int nextindex = pp_keywords[state].next; int next = 0; if (*data == pp_keywords[state].defchar) @@ -381,7 +381,8 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso switch (token) { case NOTOKEN: - ++data; + if (*data) + ++data; break; case PP_DEFINE: mode = PrepareDefine; @@ -1260,7 +1261,6 @@ void Preprocessor::parseDefineArguments(Macro *m) error("missing ')' in macro argument list"); break; } else if (!is_identifier(l.constData(), l.length())) { - qDebug() << l; error("Unexpected character in macro argument list."); } } diff --git a/src/tools/uic/cpp/cppwriteincludes.cpp b/src/tools/uic/cpp/cppwriteincludes.cpp index e93e6bb26c..a99d6adf07 100644 --- a/src/tools/uic/cpp/cppwriteincludes.cpp +++ b/src/tools/uic/cpp/cppwriteincludes.cpp @@ -291,9 +291,8 @@ void WriteIncludes::writeHeaders(const OrderedSet &headers, bool global) const StringMap::const_iterator hit = m_oldHeaderToNewHeader.constFind(sit.key()); const bool mapped = hit != m_oldHeaderToNewHeader.constEnd(); const QString header = mapped ? hit.value() : sit.key(); - if (!header.trimmed().isEmpty()) { + if (!QStringRef(&header).trimmed().isEmpty()) m_output << "#include " << openingQuote << header << closingQuote << QLatin1Char('\n'); - } } } diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 8c8141f9e5..ade3c5db35 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1255,14 +1255,14 @@ void WriteInitialization::writeProperties(const QString &varName, QString setFunction; if (stdset) { - setFunction = QLatin1String("->set"); - setFunction += propertyName.left(1).toUpper(); - setFunction += propertyName.mid(1); - setFunction += QLatin1Char('('); + setFunction = QLatin1String("->set") + + propertyName.left(1).toUpper() + + propertyName.midRef(1) + + QLatin1Char('('); } else { - setFunction = QLatin1String("->setProperty(\""); - setFunction += propertyName; - setFunction += QLatin1String("\", QVariant"); + setFunction += QLatin1String("->setProperty(\"") + + propertyName + + QLatin1String("\", QVariant"); if (p->kind() == DomProperty::Enum) setFunction += QLatin1String("::fromValue"); setFunction += QLatin1Char('('); @@ -1286,9 +1286,9 @@ void WriteInitialization::writeProperties(const QString &varName, if (stdset) propertyValue = fixString(p->elementCstring(), m_dindent); else { - propertyValue = QLatin1String("QByteArray("); - propertyValue += fixString(p->elementCstring(), m_dindent); - propertyValue += QLatin1Char(')'); + propertyValue = QLatin1String("QByteArray(") + + fixString(p->elementCstring(), m_dindent) + + QLatin1Char(')'); } } break; @@ -1304,11 +1304,8 @@ void WriteInitialization::writeProperties(const QString &varName, break; case DomProperty::Enum: propertyValue = p->elementEnum(); - if (!propertyValue.contains(QLatin1String("::"))) { - QString scope = className; - scope += QLatin1String("::"); - propertyValue.prepend(scope); - } + if (!propertyValue.contains(QLatin1String("::"))) + propertyValue = className + QLatin1String("::") + propertyValue; break; case DomProperty::Set: propertyValue = p->elementSet(); @@ -1898,31 +1895,29 @@ QString WriteInitialization::pixCall(const QString &t, const QString &text) cons if (m_option.extractImages) { const QString format = image->elementData()->attributeFormat(); const QString extension = format.left(format.indexOf(QLatin1Char('.'))).toLower(); - QString rc = QLatin1String("QPixmap(QString::fromUtf8(\":/"); - rc += m_generatedClass; - rc += QLatin1String("/images/"); - rc += text; - rc += QLatin1Char('.'); - rc += extension; - rc += QLatin1String("\"))"); - return rc; - } - QString rc = WriteIconInitialization::iconFromDataFunction(); - rc += QLatin1Char('('); - rc += text; - rc += QLatin1String("_ID)"); - return rc; + return QLatin1String("QPixmap(QString::fromUtf8(\":/") + + m_generatedClass + + QLatin1String("/images/") + + text + + QLatin1Char('.') + + extension + + QLatin1String("\"))"); + } + return WriteIconInitialization::iconFromDataFunction() + + QLatin1Char('(') + + text + + QLatin1String("_ID)"); } QString pixFunc = m_uic->pixmapFunction(); if (pixFunc.isEmpty()) pixFunc = QLatin1String("QString::fromUtf8"); - type += QLatin1Char('('); - type += pixFunc; - type += QLatin1Char('('); - type += fixString(text, m_dindent); - type += QLatin1String("))"); + type += QLatin1Char('(') + + pixFunc + + QLatin1Char('(') + + fixString(text, m_dindent) + + QLatin1String("))"); return type; } @@ -2316,23 +2311,20 @@ QString WriteInitialization::trCall(const QString &str, const QString &commentHi if (m_option.translateFunction.isEmpty()) { if (m_option.idBased) { - result = QLatin1String("qtTrId("); + result += QLatin1String("qtTrId("); } else { - result = QLatin1String("QApplication::translate(\""); - result += m_generatedClass; - result += QLatin1Char('"'); - result += QLatin1String(", "); + result += QLatin1String("QApplication::translate(\"") + + m_generatedClass + + QLatin1String("\", "); } } else { - result = m_option.translateFunction; - result += QLatin1Char('('); + result += m_option.translateFunction + QLatin1Char('('); } result += fixString(str, m_dindent); if (!m_option.idBased) { - result += QLatin1String(", "); - result += comment; + result += QLatin1String(", ") + comment; } result += QLatin1Char(')'); @@ -2473,10 +2465,8 @@ void WriteInitialization::acceptWidgetScripts(const DomScripts &widgetScripts, D QString script; for (const DomScript *domScript : qAsConst(scripts)) { const QString snippet = domScript->text(); - if (!snippet.isEmpty()) { - script += snippet.trimmed(); - script += QLatin1Char('\n'); - } + if (!snippet.isEmpty()) + script += QStringRef(&snippet).trimmed() + QLatin1Char('\n'); } if (script.isEmpty()) return; |