diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 6 | ||||
-rw-r--r-- | src/tools/moc/moc.cpp | 30 | ||||
-rw-r--r-- | src/tools/uic/python/pythonwriteimports.cpp | 6 |
3 files changed, 27 insertions, 15 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index abd015b27f..fd63b9c388 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -2260,9 +2260,9 @@ static GradleProperties readGradleProperties(const QString &path) if (line.trimmed().startsWith('#')) continue; - QList<QByteArray> prop(line.split('=')); - if (prop.size() > 1) - properties[prop.at(0).trimmed()] = prop.at(1).trimmed(); + const int idx = line.indexOf('='); + if (idx > -1) + properties[line.left(idx).trimmed()] = line.mid(idx + 1).trimmed(); } file.close(); return properties; diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 7389919911..2c0c21ff42 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -219,6 +219,7 @@ Type Moc::parseType() case DOUBLE: case VOID: case BOOL: + case AUTO: type.name += lexem(); isVoid |= (lookup(0) == VOID); break; @@ -458,15 +459,6 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro) scopedFunctionName = tempType.isScoped; } - // we don't support references as return types, it's too dangerous - if (def->type.referenceType == Type::Reference) { - QByteArray rawName = def->type.rawName; - def->type = Type("void"); - def->type.rawName = rawName; - } - - def->normalizedType = normalizeType(def->type.name); - if (!test(RPAREN)) { parseFunctionArguments(def); next(RPAREN); @@ -489,6 +481,10 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro) next(LPAREN); until(RPAREN); } + + if (def->type.name == "auto" && test(ARROW)) + def->type = parseType(); // Parse trailing return-type + if (test(SEMIC)) ; else if ((def->inlineCode = test(LBRACE))) @@ -506,6 +502,22 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro) warning(msg.constData()); return false; } + + QList<QByteArray> typeNameParts = normalizeType(def->type.name).split(' '); + if (typeNameParts.contains("auto")) { + // We expected a trailing return type but we haven't seen one + error("Function declared with auto as return type but missing trailing return type. " + "Return type deduction is not supported."); + } + + // we don't support references as return types, it's too dangerous + if (def->type.referenceType == Type::Reference) { + QByteArray rawName = def->type.rawName; + def->type = Type("void"); + def->type.rawName = rawName; + } + + def->normalizedType = normalizeType(def->type.name); return true; } diff --git a/src/tools/uic/python/pythonwriteimports.cpp b/src/tools/uic/python/pythonwriteimports.cpp index f8d5e96729..b1652874b2 100644 --- a/src/tools/uic/python/pythonwriteimports.cpp +++ b/src/tools/uic/python/pythonwriteimports.cpp @@ -39,9 +39,9 @@ QT_BEGIN_NAMESPACE static const char *standardImports = -R"I(from PySide2.QtCore import * -from PySide2.QtGui import * -from PySide2.QtWidgets import * +R"I(from PySide2.QtCore import * # type: ignore +from PySide2.QtGui import * # type: ignore +from PySide2.QtWidgets import * # type: ignore )I"; // Change the name of a qrc file "dir/foo.qrc" file to the Python |