diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qml/main.cpp | 2 | ||||
-rw-r--r-- | tools/qml/qml.pro | 9 | ||||
-rw-r--r-- | tools/qmlcachegen/qmlcache.prf | 52 | ||||
-rw-r--r-- | tools/qmlcachegen/qmlcachegen.cpp | 101 | ||||
-rw-r--r-- | tools/qmlcachegen/qmlcachegen.pro | 18 | ||||
-rw-r--r-- | tools/qmleasing/qmleasing.pro | 9 | ||||
-rw-r--r-- | tools/qmlimportscanner/qmlimportscanner.pro | 9 | ||||
-rw-r--r-- | tools/qmljs/qmljs.cpp | 2 | ||||
-rw-r--r-- | tools/qmljs/qmljs.pro | 9 | ||||
-rw-r--r-- | tools/qmllint/qmllint.pro | 9 | ||||
-rw-r--r-- | tools/qmlmin/qmlmin.pro | 9 | ||||
-rw-r--r-- | tools/qmlplugindump/main.cpp | 38 | ||||
-rw-r--r-- | tools/qmlplugindump/qmlplugindump.pro | 10 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofiler.pro | 9 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerdata.cpp | 1 | ||||
-rw-r--r-- | tools/qmlscene/main.cpp | 1 | ||||
-rw-r--r-- | tools/qmlscene/qmlscene.pro | 9 | ||||
-rw-r--r-- | tools/qmltestrunner/qmltestrunner.pro | 9 | ||||
-rw-r--r-- | tools/qmltime/qmltime.pro | 9 | ||||
-rw-r--r-- | tools/tools.pro | 8 |
20 files changed, 267 insertions, 56 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 1699d3d81b..53dd35da07 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -567,7 +567,7 @@ int main(int argc, char *argv[]) loadDummyDataFiles(e, dummyDir); for (const QString &path : qAsConst(files)) { - QUrl url = QUrl::fromUserInput(path, QDir::currentPath()); + QUrl url = QUrl::fromUserInput(path, QDir::currentPath(), QUrl::AssumeLocalFile); if (verboseMode) printf("qml: loading %s\n", qPrintable(url.toString())); QByteArray strippedFile; diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 5f05054d04..d0083c0e78 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -6,6 +6,15 @@ HEADERS += conf.h SOURCES += main.cpp RESOURCES += qml.qrc +QMAKE_TARGET_PRODUCT = qml +QMAKE_TARGET_DESCRIPTION = Utility that loads and displays QML documents + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + mac { OTHER_FILES += Info.plist QMAKE_INFO_PLIST = Info.plist diff --git a/tools/qmlcachegen/qmlcache.prf b/tools/qmlcachegen/qmlcache.prf index fed9f0d2f3..31c18a231b 100644 --- a/tools/qmlcachegen/qmlcache.prf +++ b/tools/qmlcachegen/qmlcache.prf @@ -1,12 +1,52 @@ -qtPrepareTool(QML_CACHEGEN, qmlcachegen) +static { + message("QML cache generation ahead of time is not supported in static builds") + return() +} + +qtPrepareTool(QML_CACHEGEN, qmlcachegen, _ARCH_CHECK) + +isEmpty(TARGETPATH): error("Must set TARGETPATH (QML import name) for ahead-of-time QML cache generation") !isEmpty(QT_TARGET_ARCH):QML_CACHEGEN_ARCH=$$QT_TARGET_ARCH else:QML_CACHEGEN_ARCH=$$QT_ARCH -qmlcachegen.input = QML_FILES -qmlcachegen.output = ${QMAKE_FILE_IN}c -qmlcachegen.commands = $$QML_CACHEGEN --target-architecture=$$QML_CACHEGEN_ARCH ${QMAKE_FILE_IN} +QML_CACHEGEN_ARGS=--target-architecture=$$QML_CACHEGEN_ARCH + +!system($$QML_CACHEGEN_ARCH_CHECK $$QML_CACHEGEN_ARGS --check-if-supported) { + message("QML cache generation requested but target architecture $$QML_CACHEGEN_ARCH is not supported.") + return() +} + +load(qt_build_paths) + +prefix_build: QMLCACHE_DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH +else: QMLCACHE_DESTDIR = $$[QT_INSTALL_QML]/$$TARGETPATH + +CACHEGEN_FILES= +qmlcacheinst.files = +for(qmlf, QML_FILES) { + contains(qmlf,.*\\.js$)|contains(qmlf,.*\\.qml$) { + CACHEGEN_FILES += $$absolute_path($$qmlf, $$_PRO_FILE_PWD_) + qmlcacheinst.files += $$QMLCACHE_DESTDIR/$$relative_path($$qmlf, $$_PRO_FILE_PWD_)c + } +} + +defineReplace(qmlCacheOutputFileName) { + return($$relative_path($$QMLCACHE_DESTDIR/$$relative_path($$1, $$_PRO_FILE_PWD_)c, $$OUT_PWD)) +} + +qmlcacheinst.base = $$QMLCACHE_DESTDIR +qmlcacheinst.path = $$[QT_INSTALL_QML]/$$TARGETPATH +qmlcacheinst.CONFIG = no_check_exist + +qmlcachegen.input = CACHEGEN_FILES +qmlcachegen.output = ${QMAKE_FUNC_FILE_IN_qmlCacheOutputFileName} +qmlcachegen.CONFIG = no_link target_predeps +qmlcachegen.commands = $$QML_CACHEGEN $$QML_CACHEGEN_ARGS -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} qmlcachegen.name = Generate QML Cache ${QMAKE_FILE_IN} -qmlcachegen.variable_out = AUX_QML_FILES +qmlcachegen.variable_out = GENERATED_FILES -QMAKE_EXTRA_COMPILERS += qmlcachegen +!debug_and_release|!build_all|CONFIG(release, debug|release) { + QMAKE_EXTRA_COMPILERS += qmlcachegen + INSTALLS += qmlcacheinst +} diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index 977c5b6ff1..f24ec40184 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -32,13 +32,13 @@ #include <QFile> #include <QFileInfo> #include <QDateTime> +#include <QHashFunctions> #include <private/qqmlirbuilder_p.h> #include <private/qv4isel_moth_p.h> #include <private/qqmljsparser_p.h> QT_BEGIN_NAMESPACE -extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed; namespace QV4 { namespace JIT { Q_QML_EXPORT QV4::EvalISelFactory *createISelForArchitecture(const QString &architecture); @@ -80,7 +80,40 @@ QString diagnosticErrorMessage(const QString &fileName, const QQmlJS::Diagnostic return message; } -static bool compileQmlFile(const QString &inputFileName, QV4::EvalISelFactory *iselFactory, Error *error) +// Ensure that ListElement objects keep all property assignments in their string form +static void annotateListElements(QmlIR::Document *document) +{ + QStringList listElementNames; + + foreach (const QV4::CompiledData::Import *import, document->imports) { + const QString uri = document->stringAt(import->uriIndex); + if (uri != QStringLiteral("QtQml.Models") && uri != QStringLiteral("QtQuick")) + continue; + + QString listElementName = QStringLiteral("ListElement"); + const QString qualifier = document->stringAt(import->qualifierIndex); + if (!qualifier.isEmpty()) { + listElementName.prepend(QLatin1Char('.')); + listElementName.prepend(qualifier); + } + listElementNames.append(listElementName); + } + + if (listElementNames.isEmpty()) + return; + + foreach (QmlIR::Object *object, document->objects) { + if (!listElementNames.contains(document->stringAt(object->inheritedTypeNameIndex))) + continue; + for (QmlIR::Binding *binding = object->firstBinding(); binding; binding = binding->next) { + if (binding->type != QV4::CompiledData::Binding::Type_Script) + continue; + binding->stringIndex = document->registerString(object->bindingAsString(document, binding->value.compiledScriptIndex)); + } + } +} + +static bool compileQmlFile(const QString &inputFileName, const QString &outputFileName, QV4::EvalISelFactory *iselFactory, Error *error) { QmlIR::Document irDocument(/*debugMode*/false); @@ -96,7 +129,6 @@ static bool compileQmlFile(const QString &inputFileName, QV4::EvalISelFactory *i error->message = QLatin1String("Error reading from ") + inputFileName + QLatin1Char(':') + f.errorString(); return false; } - irDocument.jsModule.sourceTimeStamp = QFileInfo(f).lastModified().toMSecsSinceEpoch(); } { @@ -112,8 +144,10 @@ static bool compileQmlFile(const QString &inputFileName, QV4::EvalISelFactory *i } } + annotateListElements(&irDocument); + { - QmlIR::JSCodeGen v4CodeGen(inputFileName, irDocument.code, &irDocument.jsModule, &irDocument.jsParserEngine, irDocument.program, /*import cache*/0, &irDocument.jsGenerator.stringTable); + QmlIR::JSCodeGen v4CodeGen(/*empty input file name*/QString(), irDocument.code, &irDocument.jsModule, &irDocument.jsParserEngine, irDocument.program, /*import cache*/0, &irDocument.jsGenerator.stringTable); for (QmlIR::Object *object: qAsConst(irDocument.objects)) { if (object->functionsAndExpressions->count == 0) continue; @@ -146,14 +180,12 @@ static bool compileQmlFile(const QString &inputFileName, QV4::EvalISelFactory *i // Disable lookups in non-standalone (aka QML) mode isel->setUseFastLookups(false); irDocument.javaScriptCompilationUnit = isel->compile(/*generate unit*/false); - // ### - QV4::CompiledData::ResolvedTypeReferenceMap dummyDependencies; - QV4::CompiledData::Unit *unit = generator.generate(irDocument, /*engine*/nullptr, dummyDependencies); + QV4::CompiledData::Unit *unit = generator.generate(irDocument); unit->flags |= QV4::CompiledData::Unit::StaticData; unit->flags |= QV4::CompiledData::Unit::PendingTypeCompilation; irDocument.javaScriptCompilationUnit->data = unit; - if (!irDocument.javaScriptCompilationUnit->saveToDisk(inputFileName, &error->message)) + if (!irDocument.javaScriptCompilationUnit->saveToDisk(outputFileName, &error->message)) return false; free(unit); @@ -161,7 +193,7 @@ static bool compileQmlFile(const QString &inputFileName, QV4::EvalISelFactory *i return true; } -static bool compileJSFile(const QString &inputFileName, QV4::EvalISelFactory *iselFactory, Error *error) +static bool compileJSFile(const QString &inputFileName, const QString &outputFileName, QV4::EvalISelFactory *iselFactory, Error *error) { QmlIR::Document irDocument(/*debugMode*/false); @@ -177,7 +209,6 @@ static bool compileJSFile(const QString &inputFileName, QV4::EvalISelFactory *is error->message = QLatin1String("Error reading from ") + inputFileName + QLatin1Char(':') + f.errorString(); return false; } - irDocument.jsModule.sourceTimeStamp = QFileInfo(f).lastModified().toMSecsSinceEpoch(); } QQmlJS::Engine *engine = &irDocument.jsParserEngine; @@ -217,7 +248,7 @@ static bool compileJSFile(const QString &inputFileName, QV4::EvalISelFactory *is { QmlIR::JSCodeGen v4CodeGen(inputFileName, irDocument.code, &irDocument.jsModule, &irDocument.jsParserEngine, irDocument.program, /*import cache*/0, &irDocument.jsGenerator.stringTable); - v4CodeGen.generateFromProgram(inputFileName, sourceCode, program, &irDocument.jsModule, QQmlJS::Codegen::GlobalCode); + v4CodeGen.generateFromProgram(/*empty input file name*/QString(), sourceCode, program, &irDocument.jsModule, QQmlJS::Codegen::GlobalCode); QList<QQmlJS::DiagnosticMessage> jsErrors = v4CodeGen.errors(); if (!jsErrors.isEmpty()) { for (const QQmlJS::DiagnosticMessage &e: qAsConst(jsErrors)) { @@ -233,17 +264,16 @@ static bool compileJSFile(const QString &inputFileName, QV4::EvalISelFactory *is // ### translation binding simplification - QScopedPointer<QV4::EvalInstructionSelection> isel(iselFactory->create(/*engine*/nullptr, /*executable allocator*/nullptr, &irDocument.jsModule, &irDocument.jsGenerator)); + QV4::ExecutableAllocator allocator; + QScopedPointer<QV4::EvalInstructionSelection> isel(iselFactory->create(/*engine*/nullptr, &allocator, &irDocument.jsModule, &irDocument.jsGenerator)); // Disable lookups in non-standalone (aka QML) mode isel->setUseFastLookups(false); irDocument.javaScriptCompilationUnit = isel->compile(/*generate unit*/false); - // ### - QV4::CompiledData::ResolvedTypeReferenceMap dummyDependencies; - QV4::CompiledData::Unit *unit = generator.generate(irDocument, /*engine*/nullptr, dummyDependencies); + QV4::CompiledData::Unit *unit = generator.generate(irDocument); unit->flags |= QV4::CompiledData::Unit::StaticData; irDocument.javaScriptCompilationUnit->data = unit; - if (!irDocument.javaScriptCompilationUnit->saveToDisk(inputFileName, &error->message)) { + if (!irDocument.javaScriptCompilationUnit->saveToDisk(outputFileName, &error->message)) { engine->setDirectives(oldDirs); return false; } @@ -257,7 +287,7 @@ static bool compileJSFile(const QString &inputFileName, QV4::EvalISelFactory *is int main(int argc, char **argv) { // Produce reliably the same output for the same input by disabling QHash's random seeding. - qt_qhash_seed.testAndSetRelaxed(-1, 0); + qSetGlobalQHashSeed(0); QCoreApplication app(argc, argv); QCoreApplication::setApplicationName(QStringLiteral("qmlcachegen")); @@ -270,37 +300,60 @@ int main(int argc, char **argv) QCommandLineOption targetArchitectureOption(QStringLiteral("target-architecture"), QCoreApplication::translate("main", "Target architecture"), QCoreApplication::translate("main", "architecture")); parser.addOption(targetArchitectureOption); + QCommandLineOption outputFileOption(QStringLiteral("o"), QCoreApplication::translate("main", "Output file name"), QCoreApplication::translate("main", "file name")); + parser.addOption(outputFileOption); + + QCommandLineOption checkIfSupportedOption(QStringLiteral("check-if-supported"), QCoreApplication::translate("main", "Check if cache generate is supported on the specified target architecture")); + parser.addOption(checkIfSupportedOption); + parser.addPositionalArgument(QStringLiteral("[qml file]"), QStringLiteral("QML source file to generate cache for.")); parser.process(app); - const QStringList sources = parser.positionalArguments(); - if (sources.isEmpty()){ + if (!parser.isSet(targetArchitectureOption)) { + fprintf(stderr, "Target architecture not specified. Please specify with --target-architecture=<arch>\n"); parser.showHelp(); - } else if (sources.count() > 1) { - fprintf(stderr, "%s\n", qPrintable(QStringLiteral("Too many input files specified: '") + sources.join(QStringLiteral("' '")) + QLatin1Char('\''))); return EXIT_FAILURE; } - const QString inputFile = sources.first(); QScopedPointer<QV4::EvalISelFactory> isel; const QString targetArchitecture = parser.value(targetArchitectureOption); isel.reset(QV4::JIT::createISelForArchitecture(targetArchitecture)); + if (parser.isSet(checkIfSupportedOption)) { + if (isel.isNull()) + return EXIT_FAILURE; + else + return EXIT_SUCCESS; + } + + const QStringList sources = parser.positionalArguments(); + if (sources.isEmpty()){ + parser.showHelp(); + } else if (sources.count() > 1) { + fprintf(stderr, "%s\n", qPrintable(QStringLiteral("Too many input files specified: '") + sources.join(QStringLiteral("' '")) + QLatin1Char('\''))); + return EXIT_FAILURE; + } + const QString inputFile = sources.first(); + if (!isel) isel.reset(new QV4::Moth::ISelFactory); Error error; + QString outputFileName = inputFile + QLatin1Char('c'); + if (parser.isSet(outputFileOption)) + outputFileName = parser.value(outputFileOption); + if (inputFile.endsWith(QLatin1String(".qml"))) { - if (!compileQmlFile(inputFile, isel.data(), &error)) { + if (!compileQmlFile(inputFile, outputFileName, isel.data(), &error)) { error.augment(QLatin1String("Error compiling qml file: ")).print(); return EXIT_FAILURE; } } else if (inputFile.endsWith(QLatin1String(".js"))) { - if (!compileJSFile(inputFile, isel.data(), &error)) { + if (!compileJSFile(inputFile, outputFileName, isel.data(), &error)) { error.augment(QLatin1String("Error compiling qml file: ")).print(); return EXIT_FAILURE; } diff --git a/tools/qmlcachegen/qmlcachegen.pro b/tools/qmlcachegen/qmlcachegen.pro index 81783d0396..25afc2860d 100644 --- a/tools/qmlcachegen/qmlcachegen.pro +++ b/tools/qmlcachegen/qmlcachegen.pro @@ -6,19 +6,9 @@ DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII SOURCES = qmlcachegen.cpp TARGET = qmlcachegen -BUILD_INTEGRATION = qmlcache.prf -!force_independent { - qmake_integration.input = BUILD_INTEGRATION - qmake_integration.output = $$[QT_HOST_DATA]/mkspecs/features/${QMAKE_FILE_BASE}.prf - qmake_integration.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - qmake_integration.name = COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - qmake_integration.CONFIG = no_clean no_link - !contains(TEMPLATE, vc.*): qmake_integration.variable_out = GENERATED_FILES - QMAKE_EXTRA_COMPILERS += qmake_integration -} - -qmake_integration_installs.files = $$BUILD_INTEGRATION -qmake_integration_installs.path = $$[QT_HOST_DATA]/mkspecs/features -INSTALLS += qmake_integration_installs +build_integration.files = qmlcache.prf +build_integration.path = $$[QT_HOST_DATA]/mkspecs/features +prefix_build: INSTALLS += build_integration +else: COPIES += build_integration load(qt_tool) diff --git a/tools/qmleasing/qmleasing.pro b/tools/qmleasing/qmleasing.pro index e334faa77a..534bc9fe98 100644 --- a/tools/qmleasing/qmleasing.pro +++ b/tools/qmleasing/qmleasing.pro @@ -17,4 +17,13 @@ FORMS += \ pane.ui \ import.ui +QMAKE_TARGET_PRODUCT = qmleasing +QMAKE_TARGET_DESCRIPTION = QML easing curve editor + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + load(qt_app) diff --git a/tools/qmlimportscanner/qmlimportscanner.pro b/tools/qmlimportscanner/qmlimportscanner.pro index c8e458c6ae..363424f948 100644 --- a/tools/qmlimportscanner/qmlimportscanner.pro +++ b/tools/qmlimportscanner/qmlimportscanner.pro @@ -5,4 +5,13 @@ DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII SOURCES += main.cpp +QMAKE_TARGET_PRODUCT = qmlimportscanner +QMAKE_TARGET_DESCRIPTION = Tool to scan projects for QML imports + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + load(qt_tool) diff --git a/tools/qmljs/qmljs.cpp b/tools/qmljs/qmljs.cpp index 081e0660d5..182547490d 100644 --- a/tools/qmljs/qmljs.cpp +++ b/tools/qmljs/qmljs.cpp @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) if (cache && QFile::exists(fn + QLatin1Char('c'))) { QQmlRefPointer<QV4::CompiledData::CompilationUnit> unit = iSelFactory->createUnitForLoading(); QString error; - if (unit->loadFromDisk(QUrl::fromLocalFile(fn), iSelFactory, &error)) { + if (unit->loadFromDisk(QUrl::fromLocalFile(fn), QFileInfo(fn).lastModified(), iSelFactory, &error)) { script.reset(new QV4::Script(&vm, nullptr, unit)); } else { std::cout << "Error loading" << qPrintable(fn) << "from disk cache:" << qPrintable(error) << std::endl; diff --git a/tools/qmljs/qmljs.pro b/tools/qmljs/qmljs.pro index 43f0ccba71..9f82f48980 100644 --- a/tools/qmljs/qmljs.pro +++ b/tools/qmljs/qmljs.pro @@ -5,4 +5,13 @@ SOURCES = qmljs.cpp include($$PWD/../../src/3rdparty/masm/masm-defs.pri) +QMAKE_TARGET_PRODUCT = qmljs +QMAKE_TARGET_DESCRIPTION = QML Javascript tool + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + load(qt_tool) diff --git a/tools/qmllint/qmllint.pro b/tools/qmllint/qmllint.pro index bc6e27cec2..27af880c8c 100644 --- a/tools/qmllint/qmllint.pro +++ b/tools/qmllint/qmllint.pro @@ -4,4 +4,13 @@ QT = core qmldevtools-private SOURCES += main.cpp +QMAKE_TARGET_PRODUCT = qmllint +QMAKE_TARGET_DESCRIPTION = QML syntax verifier + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + load(qt_tool) diff --git a/tools/qmlmin/qmlmin.pro b/tools/qmlmin/qmlmin.pro index 2cbf196863..f5248e1b69 100644 --- a/tools/qmlmin/qmlmin.pro +++ b/tools/qmlmin/qmlmin.pro @@ -2,4 +2,13 @@ option(host_build) QT = core qmldevtools-private SOURCES += main.cpp +QMAKE_TARGET_PRODUCT = qmlmin +QMAKE_TARGET_DESCRIPTION = QML/JS minifier + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + load(qt_tool) diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index acd892bedb..dd7ae36c5d 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -33,6 +33,10 @@ #include <QtQuick/private/qquickevents_p_p.h> #include <QtQuick/private/qquickpincharea_p.h> +#ifdef QT_WIDGETS_LIB +#include <QApplication> +#endif // QT_WIDGETS_LIB + #include <QtGui/QGuiApplication> #include <QtCore/QDir> #include <QtCore/QFileInfo> @@ -741,8 +745,8 @@ void sigSegvHandler(int) { void printUsage(const QString &appName) { std::cerr << qPrintable(QString( - "Usage: %1 [-v] [-noinstantiate] [-defaultplatform] [-[non]relocatable] [-dependencies <dependencies.json>] [-merge <file-to-merge.qmltypes>] [-output <output-file.qmltypes>] [-noforceqtquick] module.uri version [module/import/path]\n" - " %1 [-v] [-noinstantiate] -path path/to/qmldir/directory [version]\n" + "Usage: %1 [-v] [-qapp] [-noinstantiate] [-defaultplatform] [-[non]relocatable] [-dependencies <dependencies.json>] [-merge <file-to-merge.qmltypes>] [-output <output-file.qmltypes>] [-noforceqtquick] module.uri version [module/import/path]\n" + " %1 [-v] [-qapp] [-noinstantiate] -path path/to/qmldir/directory [version]\n" " %1 [-v] -builtins\n" "Example: %1 Qt.labs.folderlistmodel 2.0 /home/user/dev/qt-install/imports").arg( appName)) << std::endl; @@ -866,7 +870,7 @@ static bool getDependencies(const QQmlEngine &engine, const QString &pluginImpor QByteArray depencenciesData = importScanner.readAllStandardOutput(); if (!readDependenciesData(QLatin1String("<outputOfQmlimportscanner>"), depencenciesData, dependencies, QStringList(pluginImportUri), forceQtQuickDependency)) { - std::cerr << "failed to proecess output of qmlimportscanner" << std::endl; + std::cerr << "failed to process output of qmlimportscanner" << std::endl; if (importScanner.exitCode() != 0) std::cerr << importScanner.readAllStandardError().toStdString(); return false; @@ -992,10 +996,25 @@ int main(int argc, char *argv[]) else QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true); - QGuiApplication app(argc, argv); + // Check which kind of application should be instantiated. + bool useQApplication = false; + for (int i = 0; i < argc; ++i) { + QString arg = QLatin1String(argv[1]); + if (arg == QLatin1String("--qapp") || arg == QLatin1String("-qapp")) + useQApplication = true; + } + +#ifdef QT_WIDGETS_LIB + QScopedPointer<QCoreApplication> app(useQApplication + ? new QApplication(argc, argv) + : new QGuiApplication(argc, argv)); +#else + QScopedPointer<QCoreApplication> app(new QGuiApplication(argc, argv)); +#endif // QT_WIDGETS_LIB + QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR)); - const QStringList args = app.arguments(); - const QString appName = QFileInfo(app.applicationFilePath()).baseName(); + const QStringList args = app->arguments(); + const QString appName = QFileInfo(app->applicationFilePath()).baseName(); if (args.size() < 2) { printUsage(appName); return EXIT_INVALIDARGUMENTS; @@ -1065,6 +1084,9 @@ int main(int argc, char *argv[]) } else if (arg == QLatin1String("--defaultplatform") || arg == QLatin1String("-defaultplatform")) { continue; + } else if (arg == QLatin1String("--qapp") + || arg == QLatin1String("-qapp")) { + continue; } else { std::cerr << "Invalid argument: " << qPrintable(arg) << std::endl; return EXIT_INVALIDARGUMENTS; @@ -1331,8 +1353,8 @@ int main(int argc, char *argv[]) QTimer timer; timer.setSingleShot(true); timer.setInterval(0); - QObject::connect(&timer, SIGNAL(timeout()), &app, SLOT(quit())); + QObject::connect(&timer, SIGNAL(timeout()), app.data(), SLOT(quit())); timer.start(); - return app.exec(); + return app->exec(); } diff --git a/tools/qmlplugindump/qmlplugindump.pro b/tools/qmlplugindump/qmlplugindump.pro index b38eea2554..2749ec943f 100644 --- a/tools/qmlplugindump/qmlplugindump.pro +++ b/tools/qmlplugindump/qmlplugindump.pro @@ -1,4 +1,5 @@ QT += qml qml-private quick-private core-private +qtHaveModule(widgets): QT += widgets CONFIG += no_import_scan @@ -21,4 +22,13 @@ macx { CONFIG -= app_bundle } +QMAKE_TARGET_PRODUCT = qmlplugindump +QMAKE_TARGET_DESCRIPTION = QML plugin dump tool + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + load(qt_tool) diff --git a/tools/qmlprofiler/qmlprofiler.pro b/tools/qmlprofiler/qmlprofiler.pro index a65e25c657..b5bb1dcc46 100644 --- a/tools/qmlprofiler/qmlprofiler.pro +++ b/tools/qmlprofiler/qmlprofiler.pro @@ -14,4 +14,13 @@ HEADERS += \ qmlprofilerdata.h \ qmlprofilerclient.h +QMAKE_TARGET_PRODUCT = qmlprofiler +QMAKE_TARGET_DESCRIPTION = QML profiler + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + load(qt_tool) diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp index 668cb3ce2d..596ad8d47f 100644 --- a/tools/qmlprofiler/qmlprofilerdata.cpp +++ b/tools/qmlprofiler/qmlprofilerdata.cpp @@ -33,6 +33,7 @@ #include <QHash> #include <QFile> #include <QXmlStreamReader> +#include <QRegExp> #include <limits> diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 1e8d91a95b..7741c4c45b 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -33,6 +33,7 @@ #include <QtCore/qpointer.h> #include <QtCore/qscopedpointer.h> #include <QtCore/qtextstream.h> +#include <QtCore/qregexp.h> #include <QtGui/QGuiApplication> #include <QtGui/QOpenGLFunctions> diff --git a/tools/qmlscene/qmlscene.pro b/tools/qmlscene/qmlscene.pro index b1267612c5..ec73f1871a 100644 --- a/tools/qmlscene/qmlscene.pro +++ b/tools/qmlscene/qmlscene.pro @@ -7,4 +7,13 @@ SOURCES += main.cpp DEFINES += QML_RUNTIME_TESTING !contains(QT_CONFIG, no-qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING +QMAKE_TARGET_PRODUCT = qmlscene +QMAKE_TARGET_DESCRIPTION = Utility that loads and displays QML documents + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + load(qt_tool) diff --git a/tools/qmltestrunner/qmltestrunner.pro b/tools/qmltestrunner/qmltestrunner.pro index 1bb913e718..505537480c 100644 --- a/tools/qmltestrunner/qmltestrunner.pro +++ b/tools/qmltestrunner/qmltestrunner.pro @@ -3,4 +3,13 @@ SOURCES += main.cpp QT += qml qmltest CONFIG += no_import_scan +QMAKE_TARGET_PRODUCT = qmltestrunner +QMAKE_TARGET_DESCRIPTION = QML test runner + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + load(qt_tool) diff --git a/tools/qmltime/qmltime.pro b/tools/qmltime/qmltime.pro index 551a43eec1..ec1bcb5a03 100644 --- a/tools/qmltime/qmltime.pro +++ b/tools/qmltime/qmltime.pro @@ -4,4 +4,13 @@ QT += qml quick QT += quick-private macx:CONFIG -= app_bundle +QMAKE_TARGET_PRODUCT = qmltime +QMAKE_TARGET_DESCRIPTION = Tool for benchmarking the instantiation of a QML component + +win32 { + VERSION = $${QT_VERSION}.0 +} else { + VERSION = $${QT_VERSION} +} + SOURCES += qmltime.cpp diff --git a/tools/tools.pro b/tools/tools.pro index 1a90b8e776..5d9d3740ce 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -10,14 +10,18 @@ SUBDIRS += \ qml \ qmllint - qtConfig(qml-network):!contains(QT_CONFIG, no-qml-debug): SUBDIRS += qmlprofiler + qtConfig(qml-profiler): SUBDIRS += qmlprofiler qtHaveModule(quick) { !static: { SUBDIRS += \ qmlscene \ - qmlplugindump \ qmltime + + qtConfig(regularexpression):qtConfig(process) { + SUBDIRS += \ + qmlplugindump + } } qtHaveModule(widgets): SUBDIRS += qmleasing } |