diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-22 13:47:08 +0100 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-24 13:17:33 +0100 |
commit | 502d3d6744913899da87acfda5ebdab42c40329e (patch) | |
tree | 16658a328503bfd5a62b4fd5d69ffb66e9854b18 /src/tools | |
parent | d1be8b9ceb2c7b20bbe53a07154c79699540ea3d (diff) | |
parent | 06bb315beb6c2c398223cfe52cbc7f66e14a8557 (diff) |
Merge remote-tracking branch 'origin/dev' into merge-dev
Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
Diffstat (limited to 'src/tools')
29 files changed, 542 insertions, 290 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index a057aede5b..9912539a84 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -165,6 +165,7 @@ struct Options QString applicationBinary; QString rootPath; QStringList qmlImportPaths; + QStringList qrcFiles; // Versioning QString versionName; @@ -419,6 +420,7 @@ Options parseOptions() } else if (argument.compare(QLatin1String("--aab"), Qt::CaseInsensitive) == 0) { options.buildAAB = true; options.build = true; + options.jarSigner = true; } else if (options.buildAAB && argument.compare(QLatin1String("--no-build"), Qt::CaseInsensitive) == 0) { options.build = false; } else if (argument.compare(QLatin1String("--install"), Qt::CaseInsensitive) == 0) { @@ -992,7 +994,10 @@ bool readInputFile(Options *options) } } } - + { + const QJsonValue qrcFiles = jsonObject.value(QLatin1String("qrcFiles")); + options->qrcFiles = qrcFiles.toString().split(QLatin1Char(','), QString::SkipEmptyParts); + } options->packageName = packageNameFromAndroidManifest(options->androidSourceDirectory + QLatin1String("/AndroidManifest.xml")); if (options->packageName.isEmpty()) options->packageName = cleanPackageName(QLatin1String("org.qtproject.example.%1").arg(options->applicationBinary)); @@ -1730,6 +1735,12 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies) } QString rootPath = options->rootPath; + if (!options->qrcFiles.isEmpty()) { + qmlImportScanner += QLatin1String(" -qrcFiles"); + for (const QString &qrcFile : options->qrcFiles) + qmlImportScanner += QLatin1Char(' ') + shellQuote(qrcFile); + } + if (rootPath.isEmpty()) rootPath = QFileInfo(options->inputFileName).absolutePath(); else @@ -1738,14 +1749,15 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies) if (!rootPath.endsWith(QLatin1Char('/'))) rootPath += QLatin1Char('/'); + qmlImportScanner += QLatin1String(" -rootPath %1").arg(shellQuote(rootPath)); + QStringList importPaths; importPaths += shellQuote(options->qtInstallDirectory + QLatin1String("/qml")); - importPaths += shellQuote(rootPath); + if (!rootPath.isEmpty()) + importPaths += shellQuote(rootPath); for (const QString &qmlImportPath : qAsConst(options->qmlImportPaths)) importPaths += shellQuote(qmlImportPath); - - qmlImportScanner += QLatin1String(" -rootPath %1 -importPath %2") - .arg(shellQuote(rootPath), importPaths.join(QLatin1Char(' '))); + qmlImportScanner += QLatin1String(" -importPath %1").arg(importPaths.join(QLatin1Char(' '))); if (options->verbose) { fprintf(stdout, "Running qmlimportscanner with the following command: %s\n", @@ -1967,7 +1979,8 @@ bool readDependencies(Options *options) } } - if (!options->rootPath.isEmpty() && !scanImports(options, &usedDependencies)) + if ((!options->rootPath.isEmpty() || options->qrcFiles.isEmpty()) && + !scanImports(options, &usedDependencies)) return false; return true; diff --git a/src/tools/androidtestrunner/main.cpp b/src/tools/androidtestrunner/main.cpp index 3e82fded67..f25d2c2de9 100644 --- a/src/tools/androidtestrunner/main.cpp +++ b/src/tools/androidtestrunner/main.cpp @@ -471,7 +471,7 @@ int main(int argc, char *argv[]) } // Run androiddeployqt - static auto verbose = g_options.verbose ? QStringLiteral("--verbose") : QStringLiteral(); + static auto verbose = g_options.verbose ? QStringLiteral("--verbose") : QString(); if (!execCommand(QStringLiteral("%1 %3 --reinstall --output %2 --apk %4").arg(g_options.androidDeployQtCommand, g_options.buildPath, verbose, diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index c784e35607..b68bed436e 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -19,6 +19,10 @@ DEFINES += \ QT_NO_FOREACH \ QT_NO_CAST_FROM_ASCII +INCLUDEPATH += \ + $$PWD/.. \ + $$PWD/../../3rdparty/tinycbor/src + SOURCES += \ ../../corelib/codecs/qlatincodec.cpp \ ../../corelib/codecs/qtextcodec.cpp \ @@ -63,6 +67,8 @@ SOURCES += \ ../../corelib/kernel/qsharedmemory.cpp \ ../../corelib/kernel/qsystemsemaphore.cpp \ ../../corelib/plugin/quuid.cpp \ + ../../corelib/serialization/qcborcommon.cpp \ + ../../corelib/serialization/qcborstreamwriter.cpp \ ../../corelib/serialization/qcborvalue.cpp \ ../../corelib/serialization/qdatastream.cpp \ ../../corelib/serialization/qjsoncbor.cpp \ diff --git a/src/tools/moc/collectjson.cpp b/src/tools/moc/collectjson.cpp index 4029bca5e9..fe499151cb 100644 --- a/src/tools/moc/collectjson.cpp +++ b/src/tools/moc/collectjson.cpp @@ -83,7 +83,9 @@ int collectJson(const QStringList &jsonFiles, const QString &outputFile) } } - for (const QString &jsonFile: jsonFiles) { + QStringList jsonFilesSorted = jsonFiles; + jsonFilesSorted.sort(); + for (const QString &jsonFile : qAsConst(jsonFilesSorted)) { QFile f(jsonFile); if (!f.open(QIODevice::ReadOnly)) { fprintf(stderr, "Error opening %s for reading\n", qPrintable(jsonFile)); diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index ace3a4c9f3..43bbe5ad02 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -77,7 +77,7 @@ static const char *metaTypeEnumValueString(int type) QT_FOR_EACH_STATIC_TYPE(RETURN_METATYPENAME_STRING) } #undef RETURN_METATYPENAME_STRING - return 0; + return nullptr; } Generator::Generator(ClassDef *classDef, const QVector<QByteArray> &metaTypes, const QHash<QByteArray, QByteArray> &knownQObjectClasses, const QHash<QByteArray, QByteArray> &knownGadgets, FILE *outfile) @@ -194,7 +194,6 @@ static bool qualifiedNameEquals(const QByteArray &qualifiedName, const QByteArra void Generator::generateCode() { - bool isQt = (cdef->classname == "Qt"); bool isQObject = (cdef->classname == "QObject"); bool isConstructible = !cdef->constructorList.isEmpty(); @@ -237,7 +236,7 @@ void Generator::generateCode() // const int constCharArraySizeLimit = 65535; fprintf(out, "struct qt_meta_stringdata_%s_t {\n", qualifiedClassNameIdentifier.constData()); - fprintf(out, " QByteArrayData data[%d];\n", strings.size()); + fprintf(out, " const uint offsetsAndSize[%d];\n", strings.size()*2); { int stringDataLength = 0; int stringDataCounter = 0; @@ -260,11 +259,8 @@ void Generator::generateCode() // stringdata.stringdata member, and 2) the stringdata.data index of the // QByteArrayData being defined. This calculation relies on the // QByteArrayData::data() implementation returning simply "this + offset". - fprintf(out, "#define QT_MOC_LITERAL(idx, ofs, len) \\\n" - " Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \\\n" - " qptrdiff(offsetof(qt_meta_stringdata_%s_t, stringdata0) + ofs \\\n" - " - idx * sizeof(QByteArrayData)) \\\n" - " )\n", + fprintf(out, "#define QT_MOC_LITERAL(ofs, len) \\\n" + " uint(offsetof(qt_meta_stringdata_%s_t, stringdata0) + ofs), len \n", qualifiedClassNameIdentifier.constData()); fprintf(out, "static const qt_meta_stringdata_%s_t qt_meta_stringdata_%s = {\n", @@ -274,7 +270,7 @@ void Generator::generateCode() int idx = 0; for (int i = 0; i < strings.size(); ++i) { const QByteArray &str = strings.at(i); - fprintf(out, "QT_MOC_LITERAL(%d, %d, %d)", i, idx, str.length()); + fprintf(out, "QT_MOC_LITERAL(%d, %d)", idx, str.length()); if (i != strings.size() - 1) fputc(',', out); const QByteArray comment = str.length() > 32 ? str.left(29) + "..." : str; @@ -452,7 +448,7 @@ void Generator::generateCode() // // Generate internal qt_static_metacall() function // - const bool hasStaticMetaCall = !isQt && + const bool hasStaticMetaCall = (cdef->hasQObject || !cdef->methodList.isEmpty() || !cdef->propertyList.isEmpty() || !cdef->constructorList.isEmpty()); if (hasStaticMetaCall) @@ -462,7 +458,7 @@ void Generator::generateCode() // Build extra array // QVector<QByteArray> extraList; - QHash<QByteArray, QByteArray> knownExtraMetaObject = knownGadgets; + QMultiHash<QByteArray, QByteArray> knownExtraMetaObject = knownGadgets; knownExtraMetaObject.unite(knownQObjectClasses); for (int i = 0; i < cdef->propertyList.count(); ++i) { @@ -534,18 +530,17 @@ void Generator::generateCode() // // Finally create and initialize the static meta object // - if (isQt) - fprintf(out, "QT_INIT_METAOBJECT const QMetaObject QObject::staticQtMetaObject = { {\n"); - else - fprintf(out, "QT_INIT_METAOBJECT const QMetaObject %s::staticMetaObject = { {\n", cdef->qualified.constData()); + fprintf(out, "QT_INIT_METAOBJECT const QMetaObject %s::staticMetaObject = { {\n", cdef->qualified.constData()); if (isQObject) fprintf(out, " nullptr,\n"); - else if (cdef->superclassList.size() && (!cdef->hasQGadget || knownGadgets.contains(purestSuperClass))) + else if (cdef->superclassList.size() && !cdef->hasQGadget) // for qobject, we know the super class must have a static metaobject fprintf(out, " QMetaObject::SuperData::link<%s::staticMetaObject>(),\n", purestSuperClass.constData()); + else if (cdef->superclassList.size()) // for gadgets we need to query at compile time for it + fprintf(out, " QtPrivate::MetaObjectForType<%s>::value(),\n", purestSuperClass.constData()); else fprintf(out, " nullptr,\n"); - fprintf(out, " qt_meta_stringdata_%s.data,\n" + fprintf(out, " qt_meta_stringdata_%s.offsetsAndSize,\n" " qt_meta_data_%s,\n", qualifiedClassNameIdentifier.constData(), qualifiedClassNameIdentifier.constData()); if (hasStaticMetaCall) @@ -559,9 +554,6 @@ void Generator::generateCode() fprintf(out, " qt_meta_extradata_%s,\n", qualifiedClassNameIdentifier.constData()); fprintf(out, " nullptr\n} };\n\n"); - if(isQt) - return; - if (!cdef->hasQObject) return; diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp index 7da8d94efc..cc7d747f5b 100644 --- a/src/tools/moc/keywords.cpp +++ b/src/tools/moc/keywords.cpp @@ -30,12 +30,12 @@ // DO NOT EDIT. static const short keyword_trans[][128] = { - {0,0,0,0,0,0,0,0,0,568,565,0,0,0,0,0, + {0,0,0,0,0,0,0,0,0,579,576,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 568,252,566,569,8,38,239,567,25,26,236,234,30,235,27,237, + 579,252,577,580,8,38,239,578,25,26,236,234,30,235,27,237, 22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43, 0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,21,8,8,8,8,8,8,8,8,8,31,571,32,238,8, + 8,21,8,8,8,8,8,8,8,8,8,31,582,32,238,8, 0,1,2,3,4,5,6,7,8,9,8,8,10,11,12,13, 14,8,15,16,17,18,19,20,8,8,8,36,245,37,248,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -177,7 +177,7 @@ static const short keyword_trans[][128] = { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,42,0,0,0,28,0, - 574,574,574,574,574,574,574,574,574,574,0,0,0,0,0,0, + 585,585,585,585,585,585,585,585,585,585,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -336,7 +336,7 @@ static const short keyword_trans[][128] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,573,0,0,0,0,572, + 0,0,0,0,0,0,0,0,0,0,584,0,0,0,0,583, 0,0,0,0,0,0,0,0,0,0,0,0,0,258,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -378,7 +378,7 @@ static const short keyword_trans[][128] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,475,424,408,416,380,0,484,0,0,0,0,364,358, + 0,0,0,475,424,408,416,380,0,484,0,0,0,565,364,358, 386,0,557,472,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, @@ -1021,11 +1021,22 @@ static const struct {CHARACTER, 0, 79, 563, CHARACTER}, {CHARACTER, 0, 78, 564, CHARACTER}, {Q_REVISION_TOKEN, 0, 0, 0, CHARACTER}, + {CHARACTER, 0, 79, 566, CHARACTER}, + {CHARACTER, 0, 67, 567, CHARACTER}, + {CHARACTER, 0, 95, 568, CHARACTER}, + {CHARACTER, 0, 73, 569, CHARACTER}, + {CHARACTER, 0, 78, 570, CHARACTER}, + {CHARACTER, 0, 67, 571, CHARACTER}, + {CHARACTER, 0, 76, 572, CHARACTER}, + {CHARACTER, 0, 85, 573, CHARACTER}, + {CHARACTER, 0, 68, 574, CHARACTER}, + {CHARACTER, 0, 69, 575, CHARACTER}, + {Q_MOC_INCLUDE_TOKEN, 0, 0, 0, CHARACTER}, {NEWLINE, 0, 0, 0, NOTOKEN}, {QUOTE, 0, 0, 0, NOTOKEN}, {SINGLEQUOTE, 0, 0, 0, NOTOKEN}, {WHITESPACE, 0, 0, 0, NOTOKEN}, - {HASH, 0, 35, 570, HASH}, + {HASH, 0, 35, 581, HASH}, {PP_HASHHASH, 0, 0, 0, NOTOKEN}, {BACKSLASH, 0, 0, 0, NOTOKEN}, {CPP_COMMENT, 0, 0, 0, NOTOKEN}, diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 4aa040a9bb..b8c2d7f594 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -175,6 +175,49 @@ static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments) return allArguments; } +// Escape characters in given path. Dependency paths are Make-style, not NMake/Jom style. +// The paths can also be consumed by Ninja. +// "$" replaced by "$$" +// "#" replaced by "\#" +// " " replaced by "\ " +// "\#" replaced by "\\#" +// "\ " replaced by "\\\ " +// +// The escape rules are according to what clang / llvm escapes when generating a Make-style +// dependency file. +// Is a template function, because input param can be either a QString or a QByteArray. +template <typename T> struct CharType; +template <> struct CharType<QString> { using type = QLatin1Char; }; +template <> struct CharType<QByteArray> { using type = char; }; +template <typename StringType> +StringType escapeDependencyPath(const StringType &path) +{ + using CT = typename CharType<StringType>::type; + StringType escapedPath; + int size = path.size(); + escapedPath.reserve(size); + for (int i = 0; i < size; ++i) { + if (path[i] == CT('$')) { + escapedPath.append(CT('$')); + } else if (path[i] == CT('#')) { + escapedPath.append(CT('\\')); + } else if (path[i] == CT(' ')) { + escapedPath.append(CT('\\')); + int backwards_it = i - 1; + while (backwards_it > 0 && path[backwards_it] == CT('\\')) { + escapedPath.append(CT('\\')); + --backwards_it; + } + } + escapedPath.append(path[i]); + } + return escapedPath; +} + +QByteArray escapeAndEncodeDependencyPath(const QString &path) +{ + return QFile::encodeName(escapeDependencyPath(path)); +} int runMoc(int argc, char **argv) { @@ -308,6 +351,22 @@ int runMoc(int argc, char **argv) collectOption.setDescription(QStringLiteral("Instead of processing C++ code, collect previously generated JSON output into a single file.")); parser.addOption(collectOption); + QCommandLineOption depFileOption(QStringLiteral("output-dep-file")); + depFileOption.setDescription( + QStringLiteral("Output a Make-style dep file for build system consumption.")); + parser.addOption(depFileOption); + + QCommandLineOption depFilePathOption(QStringLiteral("dep-file-path")); + depFilePathOption.setDescription(QStringLiteral("Path where to write the dep file.")); + depFilePathOption.setValueName(QStringLiteral("file")); + parser.addOption(depFilePathOption); + + QCommandLineOption depFileRuleNameOption(QStringLiteral("dep-file-rule-name")); + depFileRuleNameOption.setDescription( + QStringLiteral("The rule name (first line) of the dep file.")); + depFileRuleNameOption.setValueName(QStringLiteral("rule name")); + parser.addOption(depFileRuleNameOption); + parser.addPositionalArgument(QStringLiteral("[header-file]"), QStringLiteral("Header file to read from, otherwise stdin.")); parser.addPositionalArgument(QStringLiteral("[@option-file]"), @@ -476,6 +535,7 @@ int runMoc(int argc, char **argv) // 1. preprocess const auto includeFiles = parser.values(includeOption); + QStringList validIncludesFiles; for (const QString &includeName : includeFiles) { QByteArray rawName = pp.resolveInclude(QFile::encodeName(includeName), moc.filename); if (rawName.isEmpty()) { @@ -488,6 +548,7 @@ int runMoc(int argc, char **argv) moc.symbols += Symbol(0, MOC_INCLUDE_BEGIN, rawName); moc.symbols += pp.preprocessed(rawName, &f); moc.symbols += Symbol(0, MOC_INCLUDE_END, rawName); + validIncludesFiles.append(includeName); } else { fprintf(stderr, "Warning: Cannot open %s included by moc file %s: %s\n", rawName.constData(), @@ -507,6 +568,7 @@ int runMoc(int argc, char **argv) QScopedPointer<FILE, ScopedPointerFileCloser> jsonOutput; + bool outputToFile = true; if (output.size()) { // output file specified #if defined(_MSC_VER) if (_wfopen_s(&out, reinterpret_cast<const wchar_t *>(output.utf16()), L"w") != 0) @@ -535,6 +597,7 @@ int runMoc(int argc, char **argv) } } else { // use stdout out = stdout; + outputToFile = false; } if (pp.preprocessOnly) { @@ -549,6 +612,74 @@ int runMoc(int argc, char **argv) if (output.size()) fclose(out); + if (parser.isSet(depFileOption)) { + // 4. write a Make-style dependency file (can also be consumed by Ninja). + QString depOutputFileName; + QString depRuleName = output; + + if (parser.isSet(depFileRuleNameOption)) + depRuleName = parser.value(depFileRuleNameOption); + + if (parser.isSet(depFilePathOption)) { + depOutputFileName = parser.value(depFilePathOption); + } else if (outputToFile) { + depOutputFileName = output + QLatin1String(".d"); + } else { + fprintf(stderr, "moc: Writing to stdout, but no depfile path specified.\n"); + } + + QScopedPointer<FILE, ScopedPointerFileCloser> depFileHandle; + FILE *depFileHandleRaw; +#if defined(_MSC_VER) + if (_wfopen_s(&depFileHandleRaw, + reinterpret_cast<const wchar_t *>(depOutputFileName.utf16()), L"w") != 0) +#else + depFileHandleRaw = fopen(QFile::encodeName(depOutputFileName).constData(), "w"); + if (!depFileHandleRaw) +#endif + fprintf(stderr, "moc: Cannot create dep output file '%s'. %s\n", + QFile::encodeName(depOutputFileName).constData(), + strerror(errno)); + depFileHandle.reset(depFileHandleRaw); + + if (!depFileHandle.isNull()) { + // First line is the path to the generated file. + fprintf(depFileHandle.data(), "%s: ", + escapeAndEncodeDependencyPath(depRuleName).constData()); + + QByteArrayList dependencies; + + // If there's an input file, it's the first dependency. + if (!filename.isEmpty()) { + dependencies.append(escapeAndEncodeDependencyPath(filename).constData()); + } + + // Additional passed-in includes are dependencies (like moc_predefs.h). + for (const QString &includeName : validIncludesFiles) { + dependencies.append(escapeAndEncodeDependencyPath(includeName).constData()); + } + + // Plugin metadata json files discovered via Q_PLUGIN_METADATA macros are also + // dependencies. + for (const QString &pluginMetadataFile : moc.parsedPluginMetadataFiles) { + dependencies.append(escapeAndEncodeDependencyPath(pluginMetadataFile).constData()); + } + + // All pre-processed includes are dependnecies. + // Sort the entries for easier human consumption. + auto includeList = pp.preprocessedIncludes.values(); + std::sort(includeList.begin(), includeList.end()); + + for (QByteArray &includeName : includeList) { + dependencies.append(escapeDependencyPath(includeName)); + } + + // Join dependencies, output them, and output a final new line. + const auto dependenciesJoined = dependencies.join(QByteArrayLiteral(" \\\n ")); + fprintf(depFileHandle.data(), "%s\n", dependenciesJoined.constData()); + } + } + return 0; } diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index b98198d1d5..2fb8c8dee3 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -653,6 +653,11 @@ void Moc::parse() case Q_CLASSINFO_TOKEN: parseClassInfo(&def); break; + case Q_MOC_INCLUDE_TOKEN: + // skip it, the namespace is parsed twice + next(LPAREN); + lexemUntil(RPAREN); + break; case ENUM: { EnumDef enumDef; if (parseEnum(&enumDef)) @@ -696,6 +701,9 @@ void Moc::parse() case Q_DECLARE_METATYPE_TOKEN: parseDeclareMetatype(); break; + case Q_MOC_INCLUDE_TOKEN: + parseMocInclude(); + break; case USING: if (test(NAMESPACE)) { while (test(SCOPE) || test(IDENTIFIER)) @@ -828,6 +836,9 @@ void Moc::parse() case Q_CLASSINFO_TOKEN: parseClassInfo(&def); break; + case Q_MOC_INCLUDE_TOKEN: + parseMocInclude(); + break; case Q_INTERFACES_TOKEN: parseInterfaces(&def); break; @@ -935,9 +946,9 @@ void Moc::parse() if (it != classList.end()) { it->classInfoList += def.classInfoList; - it->enumDeclarations.unite(def.enumDeclarations); + it->enumDeclarations.insert(def.enumDeclarations); it->enumList += def.enumList; - it->flagAliases.unite(def.flagAliases); + it->flagAliases.insert(def.flagAliases); } else { knownGadgets.insert(def.classname, def.qualified); knownGadgets.insert(def.qualified, def.qualified); @@ -1387,6 +1398,7 @@ void Moc::parsePluginData(ClassDef *def) error(msg.constData()); return; } + parsedPluginMetadataFiles.append(fi.canonicalFilePath()); metaData = file.readAll(); } } @@ -1561,6 +1573,16 @@ void Moc::parseDeclareMetatype() metaTypes.append(typeName); } +void Moc::parseMocInclude() +{ + next(LPAREN); + QByteArray include = lexemUntil(RPAREN); + // remove parentheses + include.remove(0, 1); + include.chop(1); + includeFiles.append(include); +} + void Moc::parseSlotInPrivate(ClassDef *def, FunctionDef::Access access) { next(LPAREN); diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 6785b7f9e8..91a03a767f 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -224,6 +224,7 @@ public: QHash<QByteArray, QByteArray> knownQObjectClasses; QHash<QByteArray, QByteArray> knownGadgets; QMap<QString, QJsonArray> metaArgs; + QVector<QString> parsedPluginMetadataFiles; void parse(); void generate(FILE *out, FILE *jsonOutput); @@ -255,6 +256,7 @@ public: void parseInterfaces(ClassDef *def); void parseDeclareInterface(); void parseDeclareMetatype(); + void parseMocInclude(); void parseSlotInPrivate(ClassDef *def, FunctionDef::Access access); void parsePrivateProperty(ClassDef *def); diff --git a/src/tools/moc/parser.cpp b/src/tools/moc/parser.cpp index b7aefae1ec..068f75d4bd 100644 --- a/src/tools/moc/parser.cpp +++ b/src/tools/moc/parser.cpp @@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE Symbol::LexemStore Symbol::lexemStore; #endif -static const char *error_msg = 0; +static const char *error_msg = nullptr; #ifdef Q_CC_MSVC #define ErrorFormatString "%s(%d): " diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index d135bddb4c..a99b8cc80c 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -943,7 +943,7 @@ int PP_Expression::primary_expression() test(PP_RPAREN); } else { next(); - value = lexem().toInt(0, 0); + value = lexem().toInt(nullptr, 0); } return value; } diff --git a/src/tools/moc/token.h b/src/tools/moc/token.h index 0cc163f9e4..c11ec6a38c 100644 --- a/src/tools/moc/token.h +++ b/src/tools/moc/token.h @@ -179,6 +179,7 @@ QT_BEGIN_NAMESPACE F(Q_SCRIPTABLE_TOKEN) \ F(Q_PRIVATE_PROPERTY_TOKEN) \ F(Q_REVISION_TOKEN) \ + F(Q_MOC_INCLUDE_TOKEN) \ F(SPECIAL_TREATMENT_MARK) \ F(MOC_INCLUDE_BEGIN) \ F(MOC_INCLUDE_END) \ diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp index 9248e9e2e7..c2cfe37fab 100644 --- a/src/tools/moc/util/generate_keywords.cpp +++ b/src/tools/moc/util/generate_keywords.cpp @@ -243,6 +243,7 @@ static const Keyword keywords[] = { { "Q_SCRIPTABLE", "Q_SCRIPTABLE_TOKEN" }, { "Q_PRIVATE_PROPERTY", "Q_PRIVATE_PROPERTY_TOKEN" }, { "Q_REVISION", "Q_REVISION_TOKEN" }, + { "Q_MOC_INCLUDE", "Q_MOC_INCLUDE_TOKEN" }, { "\n", "NEWLINE" }, { "\"", "QUOTE" }, { "\'", "SINGLEQUOTE" }, diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index 522c55593f..81ebafad79 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. @@ -61,7 +61,7 @@ static const char docTypeHeader[] = #define PROGRAMNAME "qdbuscpp2xml" #define PROGRAMVERSION "0.2" -#define PROGRAMCOPYRIGHT "Copyright (C) 2019 The Qt Company Ltd." +#define PROGRAMCOPYRIGHT "Copyright (C) 2020 The Qt Company Ltd." static QString outputFile; static int flags; diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index 019004e126..69d46632d2 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. @@ -46,7 +46,7 @@ #define PROGRAMNAME "qdbusxml2cpp" #define PROGRAMVERSION "0.8" -#define PROGRAMCOPYRIGHT "Copyright (C) 2019 The Qt Company Ltd." +#define PROGRAMCOPYRIGHT "Copyright (C) 2020 The Qt Company Ltd." #define ANNOTATION_NO_WAIT "org.freedesktop.DBus.Method.NoReply" diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 9acbce25ff..7188c81300 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -129,7 +129,7 @@ public: QLocale::Country m_country; QFileInfo m_fileInfo; RCCFileInfo *m_parent; - QHash<QString, RCCFileInfo*> m_children; + QMultiHash<QString, RCCFileInfo *> m_children; RCCResourceLibrary::CompressionAlgorithm m_compressAlgo; int m_compressLevel; int m_compressThreshold; @@ -737,7 +737,7 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file) parent->m_children.insert(node, s); parent = s; } else { - parent = parent->m_children[node]; + parent = *parent->m_children.constFind(node); } } @@ -757,7 +757,7 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file) break; } } - parent->m_children.insertMulti(filename, s); + parent->m_children.insert(filename, s); return true; } @@ -1478,13 +1478,19 @@ bool RCCResourceLibrary::writeInitializer() writeString(" return 1;\n"); writeString("}\n\n"); - writeByteArray( - "namespace {\n" - " struct initializer {\n" - " initializer() { QT_RCC_MANGLE_NAMESPACE(" + initResources + ")(); }\n" - " ~initializer() { QT_RCC_MANGLE_NAMESPACE(" + cleanResources + ")(); }\n" - " } dummy;\n" - "}\n"); + + writeString("namespace {\n" + " struct initializer {\n"); + + if (m_useNameSpace) { + writeByteArray(" initializer() { QT_RCC_MANGLE_NAMESPACE(" + initResources + ")(); }\n" + " ~initializer() { QT_RCC_MANGLE_NAMESPACE(" + cleanResources + ")(); }\n"); + } else { + writeByteArray(" initializer() { " + initResources + "(); }\n" + " ~initializer() { " + cleanResources + "(); }\n"); + } + writeString(" } dummy;\n" + "}\n"); } else if (m_format == Binary) { int i = 4; diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 0349061089..5290abf9f6 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -731,7 +731,7 @@ void WriteInitialization::acceptWidget(DomWidget *node) if (const DomProperty *picon = attributes.value(QLatin1String("icon"))) icon = QLatin1String(", ") + iconCall(picon); // Side effect: Writes icon definition m_output << m_indent << parentWidget << language::derefPointer << "addTab(" - << varName << icon << ", " << "QString())" << language::eol; + << varName << icon << ", " << language::emptyString << ')' << language::eol; autoTrOutput(ptitleString, pageDefaultString) << m_indent << parentWidget << language::derefPointer << "setTabText(" << parentWidget @@ -824,8 +824,8 @@ void WriteInitialization::acceptWidget(DomWidget *node) qPrintable(m_option.messagePrefix()), name.toLatin1().data()); } else { - m_output << m_indent << varName << language::derefPointer << "raise()" - << language::eol; + m_output << m_indent << varName << language::derefPointer + << (language::language() != Language::Python ? "raise()" : "raise_()") << language::eol; } } } @@ -1612,7 +1612,7 @@ QString WriteInitialization::writeFontProperties(const DomFont *f) } if (f->hasElementWeight() && f->elementWeight() > 0) { m_output << m_indent << fontName << ".setWeight(" - << f->elementWeight() << ");" << Qt::endl; + << f->elementWeight() << ")" << language::eol; } if (f->hasElementStrikeOut()) { m_output << m_indent << fontName << ".setStrikeOut(" @@ -2086,7 +2086,7 @@ void WriteInitialization::initializeComboBox(DomWidget *w) m_output << iconValue << ", "; if (needsTranslation(text->elementString())) { - m_output << "QString())" << language::eol; + m_output << language::emptyString << ')' << language::eol; m_refreshOut << m_indent << varName << language::derefPointer << "setItemText(" << i << ", " << trCall(text->elementString()) << ')' << language::eol; @@ -2288,7 +2288,7 @@ void WriteInitialization::initializeTreeWidget(DomWidget *w) if (str && str->text().isEmpty()) { m_output << m_indent << varName << language::derefPointer << "headerItem()" << language::derefPointer << "setText(" - << i << ", QString())" << language::eol; + << i << ", " << language::emptyString << ')' << language::eol; } } } @@ -2304,7 +2304,7 @@ void WriteInitialization::initializeTreeWidget(DomWidget *w) QString tempName = disableSorting(w, varName); - QList<Item *> items = initializeTreeWidgetItems(w->elementItem()); + const auto items = initializeTreeWidgetItems(w->elementItem()); for (int i = 0; i < items.count(); i++) { Item *itm = items[i]; itm->writeSetupUi(varName); @@ -2326,10 +2326,10 @@ void WriteInitialization::initializeTreeWidget(DomWidget *w) conditions an item is needed needs to be done bottom-up, the whole process makes two passes, storing the intermediate result in a recursive StringInitializerListMap. */ -QList<WriteInitialization::Item *> WriteInitialization::initializeTreeWidgetItems(const QVector<DomItem *> &domItems) +WriteInitialization::Items WriteInitialization::initializeTreeWidgetItems(const QVector<DomItem *> &domItems) { // items - QList<Item *> items; + Items items; const int numDomItems = domItems.size(); items.reserve(numDomItems); @@ -2357,7 +2357,7 @@ QList<WriteInitialization::Item *> WriteInitialization::initializeTreeWidgetItem // AbstractFromBuilder saves flags last, so they always end up in the last column's map. addQtFlagsInitializer(item, map, QLatin1String("flags")); - const QList<Item *> subItems = initializeTreeWidgetItems(domItem->elementItem()); + const auto subItems = initializeTreeWidgetItems(domItem->elementItem()); for (Item *subItem : subItems) item->addChild(subItem); } @@ -2372,9 +2372,11 @@ void WriteInitialization::initializeTableWidget(DomWidget *w) const auto &columns = w->elementColumn(); if (!columns.empty()) { - m_output << m_indent << "if (" << varName << language::derefPointer << "columnCount() < " - << columns.size() << ")\n" - << m_dindent << varName << language::derefPointer << "setColumnCount(" + m_output << m_indent << "if (" << varName << language::derefPointer + << "columnCount() < " << columns.size() << ')'; + if (language::language() == Language::Python) + m_output << ':'; + m_output << '\n' << m_dindent << varName << language::derefPointer << "setColumnCount(" << columns.size() << ')' << language::eol; } @@ -2400,8 +2402,11 @@ void WriteInitialization::initializeTableWidget(DomWidget *w) const auto &rows = w->elementRow(); if (!rows.isEmpty()) { - m_output << m_indent << "if (" << varName << language::derefPointer << "rowCount() < " << rows.size() << ")\n" - << m_dindent << varName << language::derefPointer << "setRowCount(" + m_output << m_indent << "if (" << varName << language::derefPointer + << "rowCount() < " << rows.size() << ')'; + if (language::language() == Language::Python) + m_output << ':'; + m_output << '\n' << m_dindent << varName << language::derefPointer << "setRowCount(" << rows.size() << ')' << language::eol; } @@ -2451,10 +2456,8 @@ void WriteInitialization::initializeTableWidget(DomWidget *w) QString WriteInitialization::trCall(const QString &str, const QString &commentHint, const QString &id) const { - if (str.isEmpty()) { - return language::language() == Language::Cpp - ? QLatin1String("QString()") : QLatin1String("\"\""); - } + if (str.isEmpty()) + return language::emptyString; QString result; QTextStream ts(&result); diff --git a/src/tools/uic/cpp/cppwriteinitialization.h b/src/tools/uic/cpp/cppwriteinitialization.h index 6f8e352f6a..0a6ddbb3c8 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.h +++ b/src/tools/uic/cpp/cppwriteinitialization.h @@ -85,7 +85,7 @@ namespace CPP { struct WriteInitialization : public TreeWalker { - using DomPropertyList = QList<DomProperty*>; + using DomPropertyList = QVector<DomProperty*>; using DomPropertyMap = QHash<QString, DomProperty*>; WriteInitialization(Uic *uic); @@ -187,7 +187,7 @@ private: }; ItemData m_setupUiData; ItemData m_retranslateUiData; - QList<Item *> m_children; + QVector<Item *> m_children; Item *m_parent = nullptr; const QString m_itemClassName; @@ -196,6 +196,7 @@ private: QTextStream &m_retranslateUiStream; Driver *m_driver; }; + using Items = QVector<Item *>; void addInitializer(Item *item, const QString &name, int column, const QString &value, const QString &directive = QString(), bool translatable = false) const; @@ -214,7 +215,7 @@ private: void initializeComboBox(DomWidget *w); void initializeListWidget(DomWidget *w); void initializeTreeWidget(DomWidget *w); - QList<Item *> initializeTreeWidgetItems(const QVector<DomItem *> &domItems); + Items initializeTreeWidgetItems(const QVector<DomItem *> &domItems); void initializeTableWidget(DomWidget *w); QString disableSorting(DomWidget *w, const QString &varName); diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp index 853538479f..6f342fb398 100644 --- a/src/tools/uic/main.cpp +++ b/src/tools/uic/main.cpp @@ -104,6 +104,10 @@ int runUic(int argc, char *argv[]) idBasedOption.setDescription(QStringLiteral("Use id based function for i18n")); parser.addOption(idBasedOption); + QCommandLineOption fromImportsOption(QStringLiteral("from-imports")); + fromImportsOption.setDescription(QStringLiteral("Python: generate imports relative to '.'")); + parser.addOption(fromImportsOption); + parser.addPositionalArgument(QStringLiteral("[uifile]"), QStringLiteral("Input file (*.ui), otherwise stdin.")); parser.process(app); @@ -114,6 +118,7 @@ int runUic(int argc, char *argv[]) driver.option().headerProtection = !parser.isSet(noProtOption); driver.option().implicitIncludes = !parser.isSet(noImplicitIncludesOption); driver.option().idBased = parser.isSet(idBasedOption); + driver.option().fromImports = parser.isSet(fromImportsOption); driver.option().postfix = parser.value(postfixOption); driver.option().translateFunction = parser.value(translateOption); driver.option().includeFile = parser.value(includeOption); diff --git a/src/tools/uic/option.h b/src/tools/uic/option.h index 4fc442e94a..8e882079c9 100644 --- a/src/tools/uic/option.h +++ b/src/tools/uic/option.h @@ -45,6 +45,7 @@ struct Option unsigned int limitXPM_LineLength : 1; unsigned int implicitIncludes: 1; unsigned int idBased: 1; + unsigned int fromImports: 1; QString inputFile; QString outputFile; @@ -65,6 +66,7 @@ struct Option limitXPM_LineLength(0), implicitIncludes(1), idBased(0), + fromImports(0), prefix(QLatin1String("Ui_")) { indent.fill(QLatin1Char(' '), 4); } diff --git a/src/tools/uic/python/pythonwriteimports.cpp b/src/tools/uic/python/pythonwriteimports.cpp index 303615f77b..963244d450 100644 --- a/src/tools/uic/python/pythonwriteimports.cpp +++ b/src/tools/uic/python/pythonwriteimports.cpp @@ -29,6 +29,7 @@ #include "pythonwriteimports.h" #include <customwidgetsinfo.h> +#include <option.h> #include <uic.h> #include <ui4.h> @@ -40,12 +41,26 @@ QT_BEGIN_NAMESPACE static const char *standardImports = R"I(from PySide2.QtCore import (QCoreApplication, QMetaObject, QObject, QPoint, QRect, QSize, QUrl, Qt) -from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QFont, +from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap, QRadialGradient) from PySide2.QtWidgets import * )I"; +// Change the name of a qrc file "dir/foo.qrc" file to the Python +// module name "foo_rc" according to project conventions. +static QString pythonResource(QString resource) +{ + const int lastSlash = resource.lastIndexOf(QLatin1Char('/')); + if (lastSlash != -1) + resource.remove(0, lastSlash + 1); + if (resource.endsWith(QLatin1String(".qrc"))) { + resource.chop(4); + resource.append(QLatin1String("_rc")); + } + return resource; +} + namespace Python { WriteImports::WriteImports(Uic *uic) : m_uic(uic) @@ -60,6 +75,23 @@ void WriteImports::acceptUI(DomUI *node) TreeWalker::acceptCustomWidgets(customWidgets); output << '\n'; } + + if (auto resources = node->elementResources()) { + const auto includes = resources->elementInclude(); + for (auto include : includes) { + if (include->hasAttributeLocation()) + writeImport(pythonResource(include->attributeLocation())); + } + output << '\n'; + } +} + +void WriteImports::writeImport(const QString &module) +{ + + if (m_uic->option().fromImports) + m_uic->output() << "from . "; + m_uic->output() << "import " << module << '\n'; } QString WriteImports::qtModuleOf(const DomCustomWidget *node) const @@ -82,11 +114,29 @@ void WriteImports::acceptCustomWidget(DomCustomWidget *node) const auto &className = node->elementClass(); if (className.contains(QLatin1String("::"))) return; // Exclude namespaced names (just to make tests pass). - const QString &qtModule = qtModuleOf(node); + const QString &importModule = qtModuleOf(node); auto &output = m_uic->output(); - if (!qtModule.isEmpty()) - output << "from PySide2." << qtModule << ' '; - output << "import " << className << '\n'; + // For starting importing PySide2 modules + if (!importModule.isEmpty()) { + output << "from "; + if (importModule.startsWith(QLatin1String("Qt"))) + output << "PySide2."; + output << importModule; + if (!className.isEmpty()) + output << " import " << className << "\n\n"; + } else { + // When the elementHeader is not set, we know it's the continuation + // of a PySide2 import or a normal import of another module. + if (!node->elementHeader() || node->elementHeader()->text().isEmpty()) { + output << "import " << className << '\n'; + } else { // When we do have elementHeader, we know it's a relative import. + QString modulePath = node->elementHeader()->text(); + // '.h' is added by default on headers for <customwidget> + if (modulePath.endsWith(QLatin1String(".h"))) + modulePath.chop(2); + output << "from " << modulePath << " import " << className << '\n'; + } + } } } // namespace Python diff --git a/src/tools/uic/python/pythonwriteimports.h b/src/tools/uic/python/pythonwriteimports.h index 427cbb48b1..5462453962 100644 --- a/src/tools/uic/python/pythonwriteimports.h +++ b/src/tools/uic/python/pythonwriteimports.h @@ -46,6 +46,7 @@ public: void acceptCustomWidget(DomCustomWidget *node) override; private: + void writeImport(const QString &module); QString qtModuleOf(const DomCustomWidget *node) const; Uic *const m_uic; diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h index bf3882edd1..841144133f 100644 --- a/src/tools/uic/qclass_lib_map.h +++ b/src/tools/uic/qclass_lib_map.h @@ -635,7 +635,6 @@ QT_CLASS_LIB(QIconEngineFactoryInterface, QtGui, qiconengineplugin.h) QT_CLASS_LIB(QIconEnginePlugin, QtGui, qiconengineplugin.h) QT_CLASS_LIB(QIconEngineFactoryInterfaceV2, QtGui, qiconengineplugin.h) QT_CLASS_LIB(QIconEnginePluginV2, QtGui, qiconengineplugin.h) -QT_CLASS_LIB(QImageTextKeyLang, QtGui, qimage.h) QT_CLASS_LIB(QImage, QtGui, qimage.h) QT_CLASS_LIB(QImageIOHandler, QtGui, qimageiohandler.h) QT_CLASS_LIB(QImageIOHandlerFactoryInterface, QtGui, qimageiohandler.h) diff --git a/src/tools/uic/shared/language.cpp b/src/tools/uic/shared/language.cpp index 235a8ed2fc..987d51e30c 100644 --- a/src/tools/uic/shared/language.cpp +++ b/src/tools/uic/shared/language.cpp @@ -49,6 +49,7 @@ void setLanguage(Language l) qualifier = QLatin1String("::"); self = QLatin1String(""); // for testing: change to "this->"; eol = QLatin1String(";\n"); + emptyString = QLatin1String("QString()"); encoding = Encoding::Utf8; break; case Language::Python: @@ -59,6 +60,7 @@ void setLanguage(Language l) qualifier = QLatin1String("."); self = QLatin1String("self."); eol = QLatin1String("\n"); + emptyString = QLatin1String("\"\""); encoding = Encoding::Unicode; break; } @@ -71,6 +73,7 @@ QString qtQualifier; QString qualifier; QString self; QString eol; +QString emptyString; QString cppQualifier = QLatin1String("::"); QString cppTrue = QLatin1String("true"); diff --git a/src/tools/uic/shared/language.h b/src/tools/uic/shared/language.h index fc8af9715b..7b019ec8fc 100644 --- a/src/tools/uic/shared/language.h +++ b/src/tools/uic/shared/language.h @@ -49,6 +49,7 @@ extern QString qtQualifier; extern QString qualifier; extern QString self; extern QString eol; +extern QString emptyString; extern QString cppQualifier; extern QString cppTrue; diff --git a/src/tools/uic/treewalker.h b/src/tools/uic/treewalker.h index 3777229517..6905d74fd9 100644 --- a/src/tools/uic/treewalker.h +++ b/src/tools/uic/treewalker.h @@ -29,7 +29,7 @@ #ifndef TREEWALKER_H #define TREEWALKER_H -#include <qlist.h> +#include <qvector.h> QT_BEGIN_NAMESPACE diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp index 334ced276d..ed00e2c3fd 100644 --- a/src/tools/uic/ui4.cpp +++ b/src/tools/uic/ui4.cpp @@ -59,7 +59,7 @@ void DomUI::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("version")) { setAttributeVersion(attribute.value().toString()); continue; @@ -94,7 +94,7 @@ void DomUI::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("author"), Qt::CaseInsensitive)) { setElementAuthor(reader.readElementText()); continue; @@ -581,7 +581,7 @@ void DomIncludes::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("include"), Qt::CaseInsensitive)) { auto *v = new DomInclude(); v->read(reader); @@ -621,7 +621,7 @@ void DomInclude::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); continue; @@ -636,7 +636,7 @@ void DomInclude::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; @@ -678,7 +678,7 @@ void DomResources::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; @@ -689,7 +689,7 @@ void DomResources::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("include"), Qt::CaseInsensitive)) { auto *v = new DomResource(); v->read(reader); @@ -732,7 +732,7 @@ void DomResource::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); continue; @@ -743,7 +743,7 @@ void DomResource::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; @@ -781,7 +781,7 @@ void DomActionGroup::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; @@ -792,7 +792,7 @@ void DomActionGroup::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("action"), Qt::CaseInsensitive)) { auto *v = new DomAction(); v->read(reader); @@ -862,13 +862,13 @@ void DomActionGroup::setElementActionGroup(const QVector<DomActionGroup *> &a) m_actionGroup = a; } -void DomActionGroup::setElementProperty(const QList<DomProperty *> &a) +void DomActionGroup::setElementProperty(const QVector<DomProperty *> &a) { m_children |= Property; m_property = a; } -void DomActionGroup::setElementAttribute(const QList<DomProperty *> &a) +void DomActionGroup::setElementAttribute(const QVector<DomProperty *> &a) { m_children |= Attribute; m_attribute = a; @@ -886,7 +886,7 @@ void DomAction::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; @@ -901,7 +901,7 @@ void DomAction::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); @@ -944,13 +944,13 @@ void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -void DomAction::setElementProperty(const QList<DomProperty *> &a) +void DomAction::setElementProperty(const QVector<DomProperty *> &a) { m_children |= Property; m_property = a; } -void DomAction::setElementAttribute(const QList<DomProperty *> &a) +void DomAction::setElementAttribute(const QVector<DomProperty *> &a) { m_children |= Attribute; m_attribute = a; @@ -962,7 +962,7 @@ void DomActionRef::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; @@ -973,7 +973,7 @@ void DomActionRef::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; @@ -1007,7 +1007,7 @@ void DomButtonGroup::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; @@ -1018,7 +1018,7 @@ void DomButtonGroup::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); @@ -1058,13 +1058,13 @@ void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) con writer.writeEndElement(); } -void DomButtonGroup::setElementProperty(const QList<DomProperty *> &a) +void DomButtonGroup::setElementProperty(const QVector<DomProperty *> &a) { m_children |= Property; m_property = a; } -void DomButtonGroup::setElementAttribute(const QList<DomProperty *> &a) +void DomButtonGroup::setElementAttribute(const QVector<DomProperty *> &a) { m_children |= Attribute; m_attribute = a; @@ -1081,7 +1081,7 @@ void DomButtonGroups::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("buttongroup"), Qt::CaseInsensitive)) { auto *v = new DomButtonGroup(); v->read(reader); @@ -1126,7 +1126,7 @@ void DomCustomWidgets::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("customwidget"), Qt::CaseInsensitive)) { auto *v = new DomCustomWidget(); v->read(reader); @@ -1166,7 +1166,7 @@ void DomHeader::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); continue; @@ -1177,7 +1177,7 @@ void DomHeader::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; @@ -1219,7 +1219,7 @@ void DomCustomWidget::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("class"), Qt::CaseInsensitive)) { setElementClass(reader.readElementText()); continue; @@ -1473,7 +1473,7 @@ void DomLayoutDefault::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("spacing")) { setAttributeSpacing(attribute.value().toInt()); continue; @@ -1488,7 +1488,7 @@ void DomLayoutDefault::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; @@ -1519,7 +1519,7 @@ void DomLayoutFunction::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("spacing")) { setAttributeSpacing(attribute.value().toString()); continue; @@ -1534,7 +1534,7 @@ void DomLayoutFunction::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; @@ -1569,7 +1569,7 @@ void DomTabStops::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("tabstop"), Qt::CaseInsensitive)) { m_tabStop.append(reader.readElementText()); continue; @@ -1615,7 +1615,7 @@ void DomLayout::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("class")) { setAttributeClass(attribute.value().toString()); continue; @@ -1650,7 +1650,7 @@ void DomLayout::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); @@ -1717,13 +1717,13 @@ void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -void DomLayout::setElementProperty(const QList<DomProperty *> &a) +void DomLayout::setElementProperty(const QVector<DomProperty *> &a) { m_children |= Property; m_property = a; } -void DomLayout::setElementAttribute(const QList<DomProperty *> &a) +void DomLayout::setElementAttribute(const QVector<DomProperty *> &a) { m_children |= Attribute; m_attribute = a; @@ -1759,7 +1759,7 @@ void DomLayoutItem::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("row")) { setAttributeRow(attribute.value().toInt()); continue; @@ -1786,7 +1786,7 @@ void DomLayoutItem::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("widget"), Qt::CaseInsensitive)) { auto *v = new DomWidget(); v->read(reader); @@ -1910,7 +1910,7 @@ void DomRow::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); @@ -1938,7 +1938,7 @@ void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -void DomRow::setElementProperty(const QList<DomProperty *> &a) +void DomRow::setElementProperty(const QVector<DomProperty *> &a) { m_children |= Property; m_property = a; @@ -1955,7 +1955,7 @@ void DomColumn::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); @@ -1983,7 +1983,7 @@ void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -void DomColumn::setElementProperty(const QList<DomProperty *> &a) +void DomColumn::setElementProperty(const QVector<DomProperty *> &a) { m_children |= Property; m_property = a; @@ -2001,7 +2001,7 @@ void DomItem::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("row")) { setAttributeRow(attribute.value().toInt()); continue; @@ -2016,7 +2016,7 @@ void DomItem::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); @@ -2059,7 +2059,7 @@ void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -void DomItem::setElementProperty(const QList<DomProperty *> &a) +void DomItem::setElementProperty(const QVector<DomProperty *> &a) { m_children |= Property; m_property = a; @@ -2101,7 +2101,7 @@ void DomWidget::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("class")) { setAttributeClass(attribute.value().toString()); continue; @@ -2120,7 +2120,7 @@ void DomWidget::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("class"), Qt::CaseInsensitive)) { m_class.append(reader.readElementText()); continue; @@ -2268,13 +2268,13 @@ void DomWidget::setElementClass(const QStringList &a) m_class = a; } -void DomWidget::setElementProperty(const QList<DomProperty *> &a) +void DomWidget::setElementProperty(const QVector<DomProperty *> &a) { m_children |= Property; m_property = a; } -void DomWidget::setElementAttribute(const QList<DomProperty *> &a) +void DomWidget::setElementAttribute(const QVector<DomProperty *> &a) { m_children |= Attribute; m_attribute = a; @@ -2344,7 +2344,7 @@ void DomSpacer::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; @@ -2355,7 +2355,7 @@ void DomSpacer::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); @@ -2386,7 +2386,7 @@ void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -void DomSpacer::setElementProperty(const QList<DomProperty *> &a) +void DomSpacer::setElementProperty(const QVector<DomProperty *> &a) { m_children |= Property; m_property = a; @@ -2398,7 +2398,7 @@ void DomColor::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("alpha")) { setAttributeAlpha(attribute.value().toInt()); continue; @@ -2409,7 +2409,7 @@ void DomColor::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("red"), Qt::CaseInsensitive)) { setElementRed(reader.readElementText().toInt()); continue; @@ -2494,7 +2494,7 @@ void DomGradientStop::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("position")) { setAttributePosition(attribute.value().toDouble()); continue; @@ -2505,7 +2505,7 @@ void DomGradientStop::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("color"), Qt::CaseInsensitive)) { auto *v = new DomColor(); v->read(reader); @@ -2568,7 +2568,7 @@ void DomGradient::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("startx")) { setAttributeStartX(attribute.value().toDouble()); continue; @@ -2627,7 +2627,7 @@ void DomGradient::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("gradientstop"), Qt::CaseInsensitive)) { auto *v = new DomGradientStop(); v->read(reader); @@ -2724,7 +2724,7 @@ void DomBrush::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("brushstyle")) { setAttributeBrushStyle(attribute.value().toString()); continue; @@ -2735,7 +2735,7 @@ void DomBrush::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("color"), Qt::CaseInsensitive)) { auto *v = new DomColor(); v->read(reader); @@ -2845,7 +2845,7 @@ void DomColorRole::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("role")) { setAttributeRole(attribute.value().toString()); continue; @@ -2856,7 +2856,7 @@ void DomColorRole::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("brush"), Qt::CaseInsensitive)) { auto *v = new DomBrush(); v->read(reader); @@ -2922,7 +2922,7 @@ void DomColorGroup::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("colorrole"), Qt::CaseInsensitive)) { auto *v = new DomColorRole(); v->read(reader); @@ -2983,7 +2983,7 @@ void DomPalette::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("active"), Qt::CaseInsensitive)) { auto *v = new DomColorGroup(); v->read(reader); @@ -3102,7 +3102,7 @@ void DomFont::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("family"), Qt::CaseInsensitive)) { setElementFamily(reader.readElementText()); continue; @@ -3308,7 +3308,7 @@ void DomPoint::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) { setElementX(reader.readElementText().toInt()); continue; @@ -3370,7 +3370,7 @@ void DomRect::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) { setElementX(reader.readElementText().toInt()); continue; @@ -3467,7 +3467,7 @@ void DomLocale::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("language")) { setAttributeLanguage(attribute.value().toString()); continue; @@ -3482,7 +3482,7 @@ void DomLocale::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; @@ -3513,7 +3513,7 @@ void DomSizePolicy::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("hsizetype")) { setAttributeHSizeType(attribute.value().toString()); continue; @@ -3528,7 +3528,7 @@ void DomSizePolicy::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("hsizetype"), Qt::CaseInsensitive)) { setElementHSizeType(reader.readElementText().toInt()); continue; @@ -3632,7 +3632,7 @@ void DomSize::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("width"), Qt::CaseInsensitive)) { setElementWidth(reader.readElementText().toInt()); continue; @@ -3694,7 +3694,7 @@ void DomDate::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("year"), Qt::CaseInsensitive)) { setElementYear(reader.readElementText().toInt()); continue; @@ -3774,7 +3774,7 @@ void DomTime::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("hour"), Qt::CaseInsensitive)) { setElementHour(reader.readElementText().toInt()); continue; @@ -3854,7 +3854,7 @@ void DomDateTime::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("hour"), Qt::CaseInsensitive)) { setElementHour(reader.readElementText().toInt()); continue; @@ -3990,7 +3990,7 @@ void DomStringList::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("notr")) { setAttributeNotr(attribute.value().toString()); continue; @@ -4013,7 +4013,7 @@ void DomStringList::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("string"), Qt::CaseInsensitive)) { m_string.append(reader.readElementText()); continue; @@ -4063,7 +4063,7 @@ void DomResourcePixmap::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("resource")) { setAttributeResource(attribute.value().toString()); continue; @@ -4078,7 +4078,7 @@ void DomResourcePixmap::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; @@ -4126,7 +4126,7 @@ void DomResourceIcon::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("theme")) { setAttributeTheme(attribute.value().toString()); continue; @@ -4141,7 +4141,7 @@ void DomResourceIcon::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("normaloff"), Qt::CaseInsensitive)) { auto *v = new DomResourcePixmap(); v->read(reader); @@ -4427,7 +4427,7 @@ void DomString::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("notr")) { setAttributeNotr(attribute.value().toString()); continue; @@ -4450,7 +4450,7 @@ void DomString::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; @@ -4495,7 +4495,7 @@ void DomPointF::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) { setElementX(reader.readElementText().toDouble()); continue; @@ -4557,7 +4557,7 @@ void DomRectF::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) { setElementX(reader.readElementText().toDouble()); continue; @@ -4655,7 +4655,7 @@ void DomSizeF::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("width"), Qt::CaseInsensitive)) { setElementWidth(reader.readElementText().toDouble()); continue; @@ -4717,7 +4717,7 @@ void DomChar::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("unicode"), Qt::CaseInsensitive)) { setElementUnicode(reader.readElementText().toInt()); continue; @@ -4764,7 +4764,7 @@ void DomUrl::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("string"), Qt::CaseInsensitive)) { auto *v = new DomString(); v->read(reader); @@ -4899,7 +4899,7 @@ void DomProperty::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; @@ -4914,7 +4914,7 @@ void DomProperty::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("bool"), Qt::CaseInsensitive)) { setElementBool(reader.readElementText()); continue; @@ -5659,7 +5659,7 @@ void DomConnections::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("connection"), Qt::CaseInsensitive)) { auto *v = new DomConnection(); v->read(reader); @@ -5703,7 +5703,7 @@ void DomConnection::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("sender"), Qt::CaseInsensitive)) { setElementSender(reader.readElementText()); continue; @@ -5836,7 +5836,7 @@ void DomConnectionHints::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("hint"), Qt::CaseInsensitive)) { auto *v = new DomConnectionHint(); v->read(reader); @@ -5876,7 +5876,7 @@ void DomConnectionHint::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("type")) { setAttributeType(attribute.value().toString()); continue; @@ -5887,7 +5887,7 @@ void DomConnectionHint::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("x"), Qt::CaseInsensitive)) { setElementX(reader.readElementText().toInt()); continue; @@ -5956,7 +5956,7 @@ void DomDesignerData::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("property"), Qt::CaseInsensitive)) { auto *v = new DomProperty(); v->read(reader); @@ -5984,7 +5984,7 @@ void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) co writer.writeEndElement(); } -void DomDesignerData::setElementProperty(const QList<DomProperty *> &a) +void DomDesignerData::setElementProperty(const QVector<DomProperty *> &a) { m_children |= Property; m_property = a; @@ -6001,7 +6001,7 @@ void DomSlots::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("signal"), Qt::CaseInsensitive)) { m_signal.append(reader.readElementText()); continue; @@ -6059,7 +6059,7 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); if (!tag.compare(QLatin1String("tooltip"), Qt::CaseInsensitive)) { auto *v = new DomPropertyToolTip(); v->read(reader); @@ -6114,7 +6114,7 @@ void DomPropertyToolTip::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; @@ -6125,7 +6125,7 @@ void DomPropertyToolTip::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; @@ -6153,7 +6153,7 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader) { const QXmlStreamAttributes &attributes = reader.attributes(); for (const QXmlStreamAttribute &attribute : attributes) { - const QStringRef name = attribute.name(); + const auto name = attribute.name(); if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; @@ -6172,7 +6172,7 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader) while (!reader.hasError()) { switch (reader.readNext()) { case QXmlStreamReader::StartElement : { - const QStringRef tag = reader.name(); + const auto tag = reader.name(); reader.raiseError(QLatin1String("Unexpected element ") + tag); } break; diff --git a/src/tools/uic/ui4.h b/src/tools/uic/ui4.h index 08a3abf490..90b17f7027 100644 --- a/src/tools/uic/ui4.h +++ b/src/tools/uic/ui4.h @@ -140,7 +140,7 @@ class DomStringPropertySpecification; */ class QDESIGNER_UILIB_EXPORT DomUI { - Q_DISABLE_COPY(DomUI) + Q_DISABLE_COPY_MOVE(DomUI) public: DomUI() = default; ~DomUI(); @@ -339,7 +339,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomIncludes { - Q_DISABLE_COPY(DomIncludes) + Q_DISABLE_COPY_MOVE(DomIncludes) public: DomIncludes() = default; ~DomIncludes(); @@ -363,7 +363,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomInclude { - Q_DISABLE_COPY(DomInclude) + Q_DISABLE_COPY_MOVE(DomInclude) public: DomInclude() = default; ~DomInclude(); @@ -397,7 +397,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomResources { - Q_DISABLE_COPY(DomResources) + Q_DISABLE_COPY_MOVE(DomResources) public: DomResources() = default; ~DomResources(); @@ -430,7 +430,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomResource { - Q_DISABLE_COPY(DomResource) + Q_DISABLE_COPY_MOVE(DomResource) public: DomResource() = default; ~DomResource(); @@ -451,7 +451,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomActionGroup { - Q_DISABLE_COPY(DomActionGroup) + Q_DISABLE_COPY_MOVE(DomActionGroup) public: DomActionGroup() = default; ~DomActionGroup(); @@ -472,11 +472,11 @@ public: inline QVector<DomActionGroup *> elementActionGroup() const { return m_actionGroup; } void setElementActionGroup(const QVector<DomActionGroup *> &a); - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementProperty() const { return m_property; } + void setElementProperty(const QVector<DomProperty *> &a); - inline QList<DomProperty*> elementAttribute() const { return m_attribute; } - void setElementAttribute(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementAttribute() const { return m_attribute; } + void setElementAttribute(const QVector<DomProperty *> &a); private: // attribute data @@ -487,8 +487,8 @@ private: uint m_children = 0; QVector<DomAction *> m_action; QVector<DomActionGroup *> m_actionGroup; - QList<DomProperty*> m_property; - QList<DomProperty*> m_attribute; + QVector<DomProperty *> m_property; + QVector<DomProperty *> m_attribute; enum Child { Action = 1, @@ -499,7 +499,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomAction { - Q_DISABLE_COPY(DomAction) + Q_DISABLE_COPY_MOVE(DomAction) public: DomAction() = default; ~DomAction(); @@ -519,11 +519,11 @@ public: inline void clearAttributeMenu() { m_has_attr_menu = false; } // child element accessors - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementProperty() const { return m_property; } + void setElementProperty(const QVector<DomProperty *> &a); - inline QList<DomProperty*> elementAttribute() const { return m_attribute; } - void setElementAttribute(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementAttribute() const { return m_attribute; } + void setElementAttribute(const QVector<DomProperty *> &a); private: // attribute data @@ -535,8 +535,8 @@ private: // child element data uint m_children = 0; - QList<DomProperty*> m_property; - QList<DomProperty*> m_attribute; + QVector<DomProperty *> m_property; + QVector<DomProperty *> m_attribute; enum Child { Property = 1, @@ -545,7 +545,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomActionRef { - Q_DISABLE_COPY(DomActionRef) + Q_DISABLE_COPY_MOVE(DomActionRef) public: DomActionRef() = default; ~DomActionRef(); @@ -566,7 +566,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomButtonGroup { - Q_DISABLE_COPY(DomButtonGroup) + Q_DISABLE_COPY_MOVE(DomButtonGroup) public: DomButtonGroup() = default; ~DomButtonGroup(); @@ -581,11 +581,11 @@ public: inline void clearAttributeName() { m_has_attr_name = false; } // child element accessors - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementProperty() const { return m_property; } + void setElementProperty(const QVector<DomProperty *> &a); - inline QList<DomProperty*> elementAttribute() const { return m_attribute; } - void setElementAttribute(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementAttribute() const { return m_attribute; } + void setElementAttribute(const QVector<DomProperty *> &a); private: // attribute data @@ -594,8 +594,8 @@ private: // child element data uint m_children = 0; - QList<DomProperty*> m_property; - QList<DomProperty*> m_attribute; + QVector<DomProperty *> m_property; + QVector<DomProperty *> m_attribute; enum Child { Property = 1, @@ -604,7 +604,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomButtonGroups { - Q_DISABLE_COPY(DomButtonGroups) + Q_DISABLE_COPY_MOVE(DomButtonGroups) public: DomButtonGroups() = default; ~DomButtonGroups(); @@ -628,7 +628,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomCustomWidgets { - Q_DISABLE_COPY(DomCustomWidgets) + Q_DISABLE_COPY_MOVE(DomCustomWidgets) public: DomCustomWidgets() = default; ~DomCustomWidgets(); @@ -652,7 +652,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomHeader { - Q_DISABLE_COPY(DomHeader) + Q_DISABLE_COPY_MOVE(DomHeader) public: DomHeader() = default; ~DomHeader(); @@ -678,7 +678,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomCustomWidget { - Q_DISABLE_COPY(DomCustomWidget) + Q_DISABLE_COPY_MOVE(DomCustomWidget) public: DomCustomWidget() = default; ~DomCustomWidget(); @@ -764,7 +764,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomLayoutDefault { - Q_DISABLE_COPY(DomLayoutDefault) + Q_DISABLE_COPY_MOVE(DomLayoutDefault) public: DomLayoutDefault() = default; ~DomLayoutDefault(); @@ -793,7 +793,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomLayoutFunction { - Q_DISABLE_COPY(DomLayoutFunction) + Q_DISABLE_COPY_MOVE(DomLayoutFunction) public: DomLayoutFunction() = default; ~DomLayoutFunction(); @@ -822,7 +822,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomTabStops { - Q_DISABLE_COPY(DomTabStops) + Q_DISABLE_COPY_MOVE(DomTabStops) public: DomTabStops() = default; ~DomTabStops(); @@ -846,7 +846,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomLayout { - Q_DISABLE_COPY(DomLayout) + Q_DISABLE_COPY_MOVE(DomLayout) public: DomLayout() = default; ~DomLayout(); @@ -891,11 +891,11 @@ public: inline void clearAttributeColumnMinimumWidth() { m_has_attr_columnMinimumWidth = false; } // child element accessors - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementProperty() const { return m_property; } + void setElementProperty(const QVector<DomProperty *> &a); - inline QList<DomProperty*> elementAttribute() const { return m_attribute; } - void setElementAttribute(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementAttribute() const { return m_attribute; } + void setElementAttribute(const QVector<DomProperty *> &a); inline QVector<DomLayoutItem *> elementItem() const { return m_item; } void setElementItem(const QVector<DomLayoutItem *> &a); @@ -925,8 +925,8 @@ private: // child element data uint m_children = 0; - QList<DomProperty*> m_property; - QList<DomProperty*> m_attribute; + QVector<DomProperty *> m_property; + QVector<DomProperty *> m_attribute; QVector<DomLayoutItem *> m_item; enum Child { @@ -937,7 +937,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomLayoutItem { - Q_DISABLE_COPY(DomLayoutItem) + Q_DISABLE_COPY_MOVE(DomLayoutItem) public: DomLayoutItem() = default; ~DomLayoutItem(); @@ -1014,7 +1014,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomRow { - Q_DISABLE_COPY(DomRow) + Q_DISABLE_COPY_MOVE(DomRow) public: DomRow() = default; ~DomRow(); @@ -1023,14 +1023,14 @@ public: void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; // child element accessors - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementProperty() const { return m_property; } + void setElementProperty(const QVector<DomProperty *> &a); private: // child element data uint m_children = 0; - QList<DomProperty*> m_property; + QVector<DomProperty *> m_property; enum Child { Property = 1 @@ -1038,7 +1038,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomColumn { - Q_DISABLE_COPY(DomColumn) + Q_DISABLE_COPY_MOVE(DomColumn) public: DomColumn() = default; ~DomColumn(); @@ -1047,14 +1047,14 @@ public: void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; // child element accessors - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementProperty() const { return m_property; } + void setElementProperty(const QVector<DomProperty *> &a); private: // child element data uint m_children = 0; - QList<DomProperty*> m_property; + QVector<DomProperty *> m_property; enum Child { Property = 1 @@ -1062,7 +1062,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomItem { - Q_DISABLE_COPY(DomItem) + Q_DISABLE_COPY_MOVE(DomItem) public: DomItem() = default; ~DomItem(); @@ -1082,8 +1082,8 @@ public: inline void clearAttributeColumn() { m_has_attr_column = false; } // child element accessors - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementProperty() const { return m_property; } + void setElementProperty(const QVector<DomProperty *> &a); inline QVector<DomItem *> elementItem() const { return m_item; } void setElementItem(const QVector<DomItem *> &a); @@ -1098,7 +1098,7 @@ private: // child element data uint m_children = 0; - QList<DomProperty*> m_property; + QVector<DomProperty *> m_property; QVector<DomItem *> m_item; enum Child { @@ -1108,7 +1108,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomWidget { - Q_DISABLE_COPY(DomWidget) + Q_DISABLE_COPY_MOVE(DomWidget) public: DomWidget() = default; ~DomWidget(); @@ -1136,11 +1136,11 @@ public: inline QStringList elementClass() const { return m_class; } void setElementClass(const QStringList &a); - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementProperty() const { return m_property; } + void setElementProperty(const QVector<DomProperty *> &a); - inline QList<DomProperty*> elementAttribute() const { return m_attribute; } - void setElementAttribute(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementAttribute() const { return m_attribute; } + void setElementAttribute(const QVector<DomProperty *> &a); inline QVector<DomRow *> elementRow() const { return m_row; } void setElementRow(const QVector<DomRow *> &a); @@ -1183,8 +1183,8 @@ private: // child element data uint m_children = 0; QStringList m_class; - QList<DomProperty*> m_property; - QList<DomProperty*> m_attribute; + QVector<DomProperty *> m_property; + QVector<DomProperty *> m_attribute; QVector<DomRow *> m_row; QVector<DomColumn *> m_column; QVector<DomItem *> m_item; @@ -1212,7 +1212,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomSpacer { - Q_DISABLE_COPY(DomSpacer) + Q_DISABLE_COPY_MOVE(DomSpacer) public: DomSpacer() = default; ~DomSpacer(); @@ -1227,8 +1227,8 @@ public: inline void clearAttributeName() { m_has_attr_name = false; } // child element accessors - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementProperty() const { return m_property; } + void setElementProperty(const QVector<DomProperty *> &a); private: // attribute data @@ -1237,7 +1237,7 @@ private: // child element data uint m_children = 0; - QList<DomProperty*> m_property; + QVector<DomProperty *> m_property; enum Child { Property = 1 @@ -1245,7 +1245,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomColor { - Q_DISABLE_COPY(DomColor) + Q_DISABLE_COPY_MOVE(DomColor) public: DomColor() = default; ~DomColor(); @@ -1294,7 +1294,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomGradientStop { - Q_DISABLE_COPY(DomGradientStop) + Q_DISABLE_COPY_MOVE(DomGradientStop) public: DomGradientStop() = default; ~DomGradientStop(); @@ -1330,7 +1330,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomGradient { - Q_DISABLE_COPY(DomGradient) + Q_DISABLE_COPY_MOVE(DomGradient) public: DomGradient() = default; ~DomGradient(); @@ -1459,7 +1459,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomBrush { - Q_DISABLE_COPY(DomBrush) + Q_DISABLE_COPY_MOVE(DomBrush) public: DomBrush() = default; ~DomBrush(); @@ -1504,7 +1504,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomColorRole { - Q_DISABLE_COPY(DomColorRole) + Q_DISABLE_COPY_MOVE(DomColorRole) public: DomColorRole() = default; ~DomColorRole(); @@ -1540,7 +1540,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomColorGroup { - Q_DISABLE_COPY(DomColorGroup) + Q_DISABLE_COPY_MOVE(DomColorGroup) public: DomColorGroup() = default; ~DomColorGroup(); @@ -1569,7 +1569,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomPalette { - Q_DISABLE_COPY(DomPalette) + Q_DISABLE_COPY_MOVE(DomPalette) public: DomPalette() = default; ~DomPalette(); @@ -1612,7 +1612,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomFont { - Q_DISABLE_COPY(DomFont) + Q_DISABLE_COPY_MOVE(DomFont) public: DomFont() = default; ~DomFont(); @@ -1701,7 +1701,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomPoint { - Q_DISABLE_COPY(DomPoint) + Q_DISABLE_COPY_MOVE(DomPoint) public: DomPoint() = default; ~DomPoint(); @@ -1734,7 +1734,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomRect { - Q_DISABLE_COPY(DomRect) + Q_DISABLE_COPY_MOVE(DomRect) public: DomRect() = default; ~DomRect(); @@ -1781,7 +1781,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomLocale { - Q_DISABLE_COPY(DomLocale) + Q_DISABLE_COPY_MOVE(DomLocale) public: DomLocale() = default; ~DomLocale(); @@ -1810,7 +1810,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomSizePolicy { - Q_DISABLE_COPY(DomSizePolicy) + Q_DISABLE_COPY_MOVE(DomSizePolicy) public: DomSizePolicy() = default; ~DomSizePolicy(); @@ -1874,7 +1874,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomSize { - Q_DISABLE_COPY(DomSize) + Q_DISABLE_COPY_MOVE(DomSize) public: DomSize() = default; ~DomSize(); @@ -1907,7 +1907,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomDate { - Q_DISABLE_COPY(DomDate) + Q_DISABLE_COPY_MOVE(DomDate) public: DomDate() = default; ~DomDate(); @@ -1947,7 +1947,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomTime { - Q_DISABLE_COPY(DomTime) + Q_DISABLE_COPY_MOVE(DomTime) public: DomTime() = default; ~DomTime(); @@ -1987,7 +1987,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomDateTime { - Q_DISABLE_COPY(DomDateTime) + Q_DISABLE_COPY_MOVE(DomDateTime) public: DomDateTime() = default; ~DomDateTime(); @@ -2048,7 +2048,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomStringList { - Q_DISABLE_COPY(DomStringList) + Q_DISABLE_COPY_MOVE(DomStringList) public: DomStringList() = default; ~DomStringList(); @@ -2105,7 +2105,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomResourcePixmap { - Q_DISABLE_COPY(DomResourcePixmap) + Q_DISABLE_COPY_MOVE(DomResourcePixmap) public: DomResourcePixmap() = default; ~DomResourcePixmap(); @@ -2139,7 +2139,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomResourceIcon { - Q_DISABLE_COPY(DomResourceIcon) + Q_DISABLE_COPY_MOVE(DomResourceIcon) public: DomResourceIcon() = default; ~DomResourceIcon(); @@ -2244,7 +2244,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomString { - Q_DISABLE_COPY(DomString) + Q_DISABLE_COPY_MOVE(DomString) public: DomString() = default; ~DomString(); @@ -2294,7 +2294,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomPointF { - Q_DISABLE_COPY(DomPointF) + Q_DISABLE_COPY_MOVE(DomPointF) public: DomPointF() = default; ~DomPointF(); @@ -2327,7 +2327,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomRectF { - Q_DISABLE_COPY(DomRectF) + Q_DISABLE_COPY_MOVE(DomRectF) public: DomRectF() = default; ~DomRectF(); @@ -2374,7 +2374,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomSizeF { - Q_DISABLE_COPY(DomSizeF) + Q_DISABLE_COPY_MOVE(DomSizeF) public: DomSizeF() = default; ~DomSizeF(); @@ -2407,7 +2407,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomChar { - Q_DISABLE_COPY(DomChar) + Q_DISABLE_COPY_MOVE(DomChar) public: DomChar() = default; ~DomChar(); @@ -2433,7 +2433,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomUrl { - Q_DISABLE_COPY(DomUrl) + Q_DISABLE_COPY_MOVE(DomUrl) public: DomUrl() = default; ~DomUrl(); @@ -2460,7 +2460,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomProperty { - Q_DISABLE_COPY(DomProperty) + Q_DISABLE_COPY_MOVE(DomProperty) public: DomProperty() = default; ~DomProperty(); @@ -2651,7 +2651,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomConnections { - Q_DISABLE_COPY(DomConnections) + Q_DISABLE_COPY_MOVE(DomConnections) public: DomConnections() = default; ~DomConnections(); @@ -2675,7 +2675,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomConnection { - Q_DISABLE_COPY(DomConnection) + Q_DISABLE_COPY_MOVE(DomConnection) public: DomConnection() = default; ~DomConnection(); @@ -2730,7 +2730,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomConnectionHints { - Q_DISABLE_COPY(DomConnectionHints) + Q_DISABLE_COPY_MOVE(DomConnectionHints) public: DomConnectionHints() = default; ~DomConnectionHints(); @@ -2754,7 +2754,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomConnectionHint { - Q_DISABLE_COPY(DomConnectionHint) + Q_DISABLE_COPY_MOVE(DomConnectionHint) public: DomConnectionHint() = default; ~DomConnectionHint(); @@ -2796,7 +2796,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomDesignerData { - Q_DISABLE_COPY(DomDesignerData) + Q_DISABLE_COPY_MOVE(DomDesignerData) public: DomDesignerData() = default; ~DomDesignerData(); @@ -2805,14 +2805,14 @@ public: void write(QXmlStreamWriter &writer, const QString &tagName = QString()) const; // child element accessors - inline QList<DomProperty*> elementProperty() const { return m_property; } - void setElementProperty(const QList<DomProperty *> &a); + inline QVector<DomProperty *> elementProperty() const { return m_property; } + void setElementProperty(const QVector<DomProperty *> &a); private: // child element data uint m_children = 0; - QList<DomProperty*> m_property; + QVector<DomProperty *> m_property; enum Child { Property = 1 @@ -2820,7 +2820,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomSlots { - Q_DISABLE_COPY(DomSlots) + Q_DISABLE_COPY_MOVE(DomSlots) public: DomSlots() = default; ~DomSlots(); @@ -2849,7 +2849,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomPropertySpecifications { - Q_DISABLE_COPY(DomPropertySpecifications) + Q_DISABLE_COPY_MOVE(DomPropertySpecifications) public: DomPropertySpecifications() = default; ~DomPropertySpecifications(); @@ -2878,7 +2878,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomPropertyToolTip { - Q_DISABLE_COPY(DomPropertyToolTip) + Q_DISABLE_COPY_MOVE(DomPropertyToolTip) public: DomPropertyToolTip() = default; ~DomPropertyToolTip(); @@ -2899,7 +2899,7 @@ private: }; class QDESIGNER_UILIB_EXPORT DomStringPropertySpecification { - Q_DISABLE_COPY(DomStringPropertySpecification) + Q_DISABLE_COPY_MOVE(DomStringPropertySpecification) public: DomStringPropertySpecification() = default; ~DomStringPropertySpecification(); diff --git a/src/tools/uic/utils.h b/src/tools/uic/utils.h index 34c4ab23d4..bd543c7bb7 100644 --- a/src/tools/uic/utils.h +++ b/src/tools/uic/utils.h @@ -42,7 +42,7 @@ inline bool toBool(const QString &str) inline QString toString(const DomString *str) { return str ? str->text() : QString(); } -inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties) +inline QHash<QString, DomProperty *> propertyMap(const QVector<DomProperty *> &properties) { QHash<QString, DomProperty *> map; for (DomProperty *p : properties) |