diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qml/conf/content/resizeItemToWindow.qml | 70 | ||||
-rw-r--r-- | tools/qml/conf/content/resizeWindowToItem.qml (renamed from tools/qml/conf/qtquick.qml) | 6 | ||||
-rw-r--r-- | tools/qml/conf/default.qml (renamed from tools/qml/conf/configuration.qml) | 4 | ||||
-rw-r--r-- | tools/qml/conf/resizeToItem.qml | 57 | ||||
-rw-r--r-- | tools/qml/main.cpp | 377 | ||||
-rw-r--r-- | tools/qml/qml.qrc | 6 | ||||
-rw-r--r-- | tools/qmlcachegen/generateloader.cpp | 2 | ||||
-rw-r--r-- | tools/qmlcachegen/qmlcachegen.cpp | 92 | ||||
-rw-r--r-- | tools/qmlimportscanner/main.cpp | 5 | ||||
-rw-r--r-- | tools/qmljs/qmljs.cpp | 3 | ||||
-rw-r--r-- | tools/qmllint/main.cpp | 4 | ||||
-rw-r--r-- | tools/qmlplugindump/main.cpp | 5 | ||||
-rw-r--r-- | tools/qmlscene/main.cpp | 51 | ||||
-rw-r--r-- | tools/qmltime/qmltime.cpp | 4 | ||||
-rw-r--r-- | tools/tools.pro | 2 |
15 files changed, 440 insertions, 248 deletions
diff --git a/tools/qml/conf/content/resizeItemToWindow.qml b/tools/qml/conf/content/resizeItemToWindow.qml new file mode 100644 index 0000000000..a645cf8ea9 --- /dev/null +++ b/tools/qml/conf/content/resizeItemToWindow.qml @@ -0,0 +1,70 @@ +/***************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +*****************************************************************************/ +import QtQuick.Window 2.0 +import QtQuick 2.0 + +Window { + property Item containedObject: null + property bool __resizeGuard: false + onContainedObjectChanged: { + if (containedObject == undefined || containedObject == null) { + visible = false; + return; + } + __resizeGuard = true + width = containedObject.width; + height = containedObject.height; + containedObject.parent = contentItem; + visible = true; + __resizeGuard = false + } + onWidthChanged: if (!__resizeGuard && containedObject) containedObject.width = width + onHeightChanged: if (!__resizeGuard && containedObject) containedObject.height = height +} diff --git a/tools/qml/conf/qtquick.qml b/tools/qml/conf/content/resizeWindowToItem.qml index ef7a46eb2f..cd03e5065a 100644 --- a/tools/qml/conf/qtquick.qml +++ b/tools/qml/conf/content/resizeWindowToItem.qml @@ -1,6 +1,6 @@ /***************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtQuick module of the Qt Toolkit. @@ -57,8 +57,8 @@ Window { visible = false; return; } - width = containedObject.width; - height = containedObject.height; + width = Qt.binding(function() { return containedObject.width }); + height = Qt.binding(function() { return containedObject.height }); containedObject.parent = contentItem; visible = true; } diff --git a/tools/qml/conf/configuration.qml b/tools/qml/conf/default.qml index e12fa39a3e..be44ee79b4 100644 --- a/tools/qml/conf/configuration.qml +++ b/tools/qml/conf/default.qml @@ -1,6 +1,6 @@ /***************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtQuick module of the Qt Toolkit. @@ -52,6 +52,6 @@ import QmlRuntime.Config 1.0 Configuration { PartialScene { itemType: "QQuickItem" - container: "qtquick.qml" + container: "content/resizeItemToWindow.qml" } } diff --git a/tools/qml/conf/resizeToItem.qml b/tools/qml/conf/resizeToItem.qml new file mode 100644 index 0000000000..480995a6b0 --- /dev/null +++ b/tools/qml/conf/resizeToItem.qml @@ -0,0 +1,57 @@ +/***************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +*****************************************************************************/ +import QmlRuntime.Config 1.0 + +Configuration { + PartialScene { + itemType: "QQuickItem" + container: "content/resizeWindowToItem.qml" + } +} diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 8cfc0eaaac..9edc90e050 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -44,9 +44,12 @@ #include <QQmlApplicationEngine> #include <QQmlComponent> +#include <QCommandLineOption> +#include <QCommandLineParser> #include <QDir> #include <QFile> #include <QFileInfo> +#include <QLoggingCategory> #include <QStringList> #include <QScopedPointer> #include <QDebug> @@ -66,23 +69,39 @@ #include <cstring> #include <cstdlib> -#define VERSION_MAJ 1 -#define VERSION_MIN 1 -#define VERSION_STR "1.1" - #define FILE_OPEN_EVENT_WAIT_TIME 3000 // ms +enum QmlApplicationType { + QmlApplicationTypeUnknown + , QmlApplicationTypeCore +#ifdef QT_GUI_LIB + , QmlApplicationTypeGui +#ifdef QT_WIDGETS_LIB + , QmlApplicationTypeWidget +#endif // QT_WIDGETS_LIB +#endif // QT_GUI_LIB +}; + +static QmlApplicationType applicationType = +#ifndef QT_GUI_LIB + QmlApplicationTypeCore; +#else + QmlApplicationTypeGui; +#endif // QT_GUI_LIB + static Config *conf = nullptr; static QQmlApplicationEngine *qae = nullptr; #if defined(Q_OS_DARWIN) || defined(QT_GUI_LIB) static int exitTimerId = -1; #endif -bool verboseMode = false; static const QString iconResourcePath(QStringLiteral(":/qt-project.org/QmlRuntime/resources/qml-64.png")); +static const QString confResourcePath(QStringLiteral(":/qt-project.org/QmlRuntime/conf/")); +static bool verboseMode = false; +static bool quietMode = false; static void loadConf(const QString &override, bool quiet) // Terminates app on failure { - const QString defaultFileName = QLatin1String("configuration.qml"); + const QString defaultFileName = QLatin1String("default.qml"); QUrl settingsUrl; bool builtIn = false; //just for keeping track of the warning if (override.isEmpty()) { @@ -92,29 +111,38 @@ static void loadConf(const QString &override, bool quiet) // Terminates app on f settingsUrl = QUrl::fromLocalFile(fi.absoluteFilePath()); } else { // ### If different built-in configs are needed per-platform, just apply QFileSelector to the qrc conf.qml path - settingsUrl = QUrl(QLatin1String("qrc:///qt-project.org/QmlRuntime/conf/") + defaultFileName); + fi.setFile(confResourcePath + defaultFileName); + settingsUrl = QUrl::fromLocalFile(fi.absoluteFilePath()); builtIn = true; } } else { QFileInfo fi; - fi.setFile(override); - if (!fi.exists()) { - printf("qml: Couldn't find required configuration file: %s\n", - qPrintable(QDir::toNativeSeparators(fi.absoluteFilePath()))); - exit(1); + fi.setFile(confResourcePath + override + QLatin1String(".qml")); + if (fi.exists()) { + settingsUrl = QUrl::fromLocalFile(fi.absoluteFilePath()); + builtIn = true; + } else { + fi.setFile(override); + if (!fi.exists()) { + printf("qml: Couldn't find required configuration file: %s\n", + qPrintable(QDir::toNativeSeparators(fi.absoluteFilePath()))); + exit(1); + } + settingsUrl = QUrl::fromLocalFile(fi.absoluteFilePath()); } - settingsUrl = QUrl::fromLocalFile(fi.absoluteFilePath()); } if (!quiet) { printf("qml: %s\n", QLibraryInfo::build()); - if (builtIn) - printf("qml: Using built-in configuration.\n"); - else - printf("qml: Using configuration file: %s\n", + if (builtIn) { + printf("qml: Using built-in configuration: %s\n", + qPrintable(override.isEmpty() ? defaultFileName : override)); + } else { + printf("qml: Using configuration: %s\n", qPrintable(settingsUrl.isLocalFile() ? QDir::toNativeSeparators(settingsUrl.toLocalFile()) : settingsUrl.toString())); + } } // TODO: When we have better engine control, ban QtQuick* imports on this engine @@ -128,9 +156,23 @@ static void loadConf(const QString &override, bool quiet) // Terminates app on f } } -#ifdef QT_GUI_LIB +void noFilesGiven() +{ + if (!quietMode) + printf("qml: No files specified. Terminating.\n"); + exit(1); +} + +static void listConfFiles() +{ + QDir confResourceDir(confResourcePath); + printf("%s\n", qPrintable(QCoreApplication::translate("main", "Built-in configurations:"))); + for (const QFileInfo &fi : confResourceDir.entryInfoList(QDir::Files)) + printf(" %s\n", qPrintable(fi.baseName())); + exit(0); +} -void noFilesGiven(); +#ifdef QT_GUI_LIB // Loads qml after receiving a QFileOpenEvent class LoaderApplication : public QGuiApplication @@ -179,8 +221,8 @@ public: connect(e, &QQmlEngine::exit, this, &LoadWatcher::exit); } - bool earlyExit = false; int returnCode = 0; + bool earlyExit = false; public Q_SLOTS: void checkFinished(QObject *o, const QUrl &url) @@ -221,8 +263,8 @@ private: void checkForWindow(QObject *o); private: - int expectedFileCount; bool haveWindow = false; + int expectedFileCount; }; void LoadWatcher::contain(QObject *o, const QUrl &containPath) @@ -282,93 +324,18 @@ void quietMessageHandler(QtMsgType type, const QMessageLogContext &ctxt, const Q exit(-1); case QtCriticalMsg: case QtDebugMsg: + case QtInfoMsg: case QtWarningMsg: - default: ; } } - -// ### Should command line arguments have translations? Qt creator doesn't, so maybe it's not worth it. -enum QmlApplicationType { - QmlApplicationTypeUnknown - , QmlApplicationTypeCore -#ifdef QT_GUI_LIB - , QmlApplicationTypeGui -#ifdef QT_WIDGETS_LIB - , QmlApplicationTypeWidget -#endif // QT_WIDGETS_LIB -#endif // QT_GUI_LIB -}; - -#ifndef QT_GUI_LIB -QmlApplicationType applicationType = QmlApplicationTypeCore; -#else -QmlApplicationType applicationType = QmlApplicationTypeGui; -#endif // QT_GUI_LIB -bool quietMode = false; -void printVersion() -{ - printf("qml binary version "); - printf(VERSION_STR); - printf("\nbuilt with Qt version "); - printf(QT_VERSION_STR); - printf("\n"); - exit(0); -} - -void printUsage() -{ - printf("Usage: qml [options] [files] [-- args]\n"); - printf("\n"); - printf("Any unknown argument before '--' will be treated as a QML file to be loaded.\n"); - printf("Any number of QML files can be loaded. They will share the same engine.\n"); - printf("'gui' application type is only available if the QtGui module is available.\n"); - printf("'widget' application type is only available if the QtWidgets module is available.\n"); - printf("\n"); - printf("General Options:\n"); - printf("\t-h, -help..................... Print this usage information and exit.\n"); - printf("\t-v, -version.................. Print the version information and exit.\n"); -#ifdef QT_GUI_LIB -#ifndef QT_WIDGETS_LIB - printf("\t-apptype [core|gui] .......... Select which application class to use. Default is gui.\n"); -#else - printf("\t-apptype [core|gui|widget] ... Select which application class to use. Default is gui.\n"); -#endif // QT_WIDGETS_LIB -#endif // QT_GUI_LIB - printf("\t-quiet ....................... Suppress all output.\n"); - printf("\t-I [path] .................... Prepend the given path to the import paths.\n"); - printf("\t-f [file] .................... Load the given file as a QML file.\n"); - printf("\t-config [file] ............... Load the given file as the configuration file.\n"); - printf("\t-- ........................... Arguments after this one are ignored by the launcher, but may be used within the QML application.\n"); - printf("\tGL options:\n"); - printf("\t-desktop.......................Force use of desktop GL (AA_UseDesktopOpenGL)\n"); - printf("\t-gles..........................Force use of GLES (AA_UseOpenGLES)\n"); - printf("\t-software......................Force use of software rendering (AA_UseOpenGLES)\n"); - printf("\t-scaling.......................Enable High DPI scaling (AA_EnableHighDpiScaling)\n"); - printf("\t-no-scaling....................Disable High DPI scaling (AA_DisableHighDpiScaling)\n"); - printf("\tDebugging options:\n"); - printf("\t-verbose ..................... Print information about what qml is doing, like specific file urls being loaded.\n"); - printf("\t-translation [file] .......... Load the given file as the translations file.\n"); - printf("\t-dummy-data [directory] ...... Load QML files from the given directory as context properties.\n"); - printf("\t-slow-animations ............. Run all animations in slow motion.\n"); - printf("\t-fixed-animations ............ Run animations off animation tick rather than wall time.\n"); - exit(0); -} - -void noFilesGiven() -{ - if (!quietMode) - printf("qml: No files specified. Terminating.\n"); - exit(1); -} - // Called before application initialization, removes arguments it uses void getAppFlags(int &argc, char **argv) { #ifdef QT_GUI_LIB for (int i=0; i<argc; i++) { - if (!strcmp(argv[i], "-apptype")) { // Must be done before application, as it selects application + if (!strcmp(argv[i], "--apptype") || !strcmp(argv[i], "-a") || !strcmp(argv[i], "-apptype")) { applicationType = QmlApplicationTypeUnknown; if (i+1 < argc) { if (!strcmp(argv[i+1], "core")) @@ -380,15 +347,6 @@ void getAppFlags(int &argc, char **argv) applicationType = QmlApplicationTypeWidget; #endif // QT_WIDGETS_LIB } - - if (applicationType == QmlApplicationTypeUnknown) { -#ifndef QT_WIDGETS_LIB - printf("-apptype must be followed by one of the following: core gui\n"); -#else - printf("-apptype must be followed by one of the following: core gui widget\n"); -#endif // QT_WIDGETS_LIB - printUsage(); - } for (int j=i; j<argc-2; j++) argv[j] = argv[j+2]; argc -= 2; @@ -442,9 +400,6 @@ int main(int argc, char *argv[]) getAppFlags(argc, argv); QCoreApplication *app = nullptr; switch (applicationType) { - case QmlApplicationTypeCore: - app = new QCoreApplication(argc, argv); - break; #ifdef QT_GUI_LIB case QmlApplicationTypeGui: app = new LoaderApplication(argc, argv); @@ -456,8 +411,10 @@ int main(int argc, char *argv[]) break; #endif // QT_WIDGETS_LIB #endif // QT_GUI_LIB - default: - Q_ASSERT_X(false, Q_FUNC_INFO, "impossible case"); + case QmlApplicationTypeCore: + Q_FALLTHROUGH(); + default: // QmlApplicationTypeUnknown: not allowed, but we'll exit after checking apptypeOption below + app = new QCoreApplication(argc, argv); break; } @@ -475,67 +432,143 @@ int main(int argc, char *argv[]) QString dummyDir; // Handle main arguments - const QStringList argList = app->arguments(); - for (int i = 1; i < argList.count(); i++) { - const QString &arg = argList[i]; - if (arg == QLatin1String("-quiet")) - quietMode = true; - else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) - printVersion(); - else if (arg == QLatin1String("-h") || arg == QLatin1String("-help")) - printUsage(); - else if (arg == QLatin1String("--")) - break; - else if (arg == QLatin1String("-verbose")) - verboseMode = true; + QCommandLineParser parser; + parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); + parser.setOptionsAfterPositionalArgumentsMode(QCommandLineParser::ParseAsPositionalArguments); + const QCommandLineOption helpOption = parser.addHelpOption(); + const QCommandLineOption versionOption = parser.addVersionOption(); +#ifdef QT_GUI_LIB + QCommandLineOption apptypeOption(QStringList() << QStringLiteral("a") << QStringLiteral("apptype"), + QCoreApplication::translate("main", "Select which application class to use. Default is gui."), +#ifdef QT_WIDGETS_LIB + QStringLiteral("core|gui|widget")); +#else + QStringLiteral("core|gui")); +#endif // QT_WIDGETS_LIB + parser.addOption(apptypeOption); // Just for the help text... we've already handled this argument above +#endif // QT_GUI_LIB + QCommandLineOption importOption(QStringLiteral("I"), + QCoreApplication::translate("main", "Prepend the given path to the import paths."), QStringLiteral("path")); + parser.addOption(importOption); + QCommandLineOption qmlFileOption(QStringLiteral("f"), + QCoreApplication::translate("main", "Load the given file as a QML file."), QStringLiteral("file")); + parser.addOption(qmlFileOption); + QCommandLineOption configOption(QStringList() << QStringLiteral("c") << QStringLiteral("config"), + QCoreApplication::translate("main", "Load the given built-in configuration or configuration file."), QStringLiteral("file")); + parser.addOption(configOption); + QCommandLineOption listConfOption(QStringList() << QStringLiteral("list-conf"), + QCoreApplication::translate("main", "List the built-in configurations.")); + parser.addOption(listConfOption); + QCommandLineOption translationOption(QStringLiteral("translation"), + QCoreApplication::translate("main", "Load the given file as the translations file."), QStringLiteral("file")); + parser.addOption(translationOption); + QCommandLineOption dummyDataOption(QStringLiteral("dummy-data"), + QCoreApplication::translate("main", "Load QML files from the given directory as context properties."), QStringLiteral("file")); + parser.addOption(dummyDataOption); + // OpenGL options + QCommandLineOption glDesktopOption(QStringLiteral("desktop"), + QCoreApplication::translate("main", "Force use of desktop OpenGL (AA_UseDesktopOpenGL).")); + parser.addOption(glDesktopOption); + QCommandLineOption glEsOption(QStringLiteral("gles"), + QCoreApplication::translate("main", "Force use of GLES (AA_UseOpenGLES).")); + parser.addOption(glEsOption); + QCommandLineOption glSoftwareOption(QStringLiteral("software"), + QCoreApplication::translate("main", "Force use of software rendering (AA_UseSoftwareOpenGL).")); + parser.addOption(glSoftwareOption); + QCommandLineOption scalingOption(QStringLiteral("scaling"), + QCoreApplication::translate("main", "Enable High DPI scaling (AA_EnableHighDpiScaling).")); + parser.addOption(scalingOption); + QCommandLineOption noScalingOption(QStringLiteral("no-scaling"), + QCoreApplication::translate("main", "Disable High DPI scaling (AA_DisableHighDpiScaling).")); + parser.addOption(noScalingOption); + // Debugging and verbosity options + QCommandLineOption quietOption(QStringLiteral("quiet"), + QCoreApplication::translate("main", "Suppress all output.")); + parser.addOption(quietOption); + QCommandLineOption verboseOption(QStringLiteral("verbose"), + QCoreApplication::translate("main", "Print information about what qml is doing, like specific file URLs being loaded.")); + parser.addOption(verboseOption); + QCommandLineOption slowAnimationsOption(QStringLiteral("slow-animations"), + QCoreApplication::translate("main", "Run all animations in slow motion.")); + parser.addOption(slowAnimationsOption); + QCommandLineOption fixedAnimationsOption(QStringLiteral("fixed-animations"), + QCoreApplication::translate("main", "Run animations off animation tick rather than wall time.")); + parser.addOption(fixedAnimationsOption); + QCommandLineOption rhiOption(QStringList() << QStringLiteral("r") << QStringLiteral("rhi"), + QCoreApplication::translate("main", "Use the Qt graphics abstraction (RHI) instead of OpenGL directly. " + "Backend is one of: default, vulkan, metal, d3d11, gl"), + QStringLiteral("backend")); + parser.addOption(rhiOption); + + // Positional arguments + parser.addPositionalArgument("files", + QCoreApplication::translate("main", "Any number of QML files can be loaded. They will share the same engine."), "[files...]"); + parser.addPositionalArgument("args", + QCoreApplication::translate("main", "Arguments after '--' are ignored, but passed through to the application.arguments variable in QML."), "[-- args...]"); + + if (!parser.parse(QCoreApplication::arguments())) { + qWarning() << parser.errorText(); + exit(1); + } + if (parser.isSet(versionOption)) + parser.showVersion(); + if (parser.isSet(helpOption)) + parser.showHelp(); + if (parser.isSet(listConfOption)) + listConfFiles(); + if (applicationType == QmlApplicationTypeUnknown) { +#ifdef QT_WIDGETS_LIB + qWarning() << QCoreApplication::translate("main", "--apptype must be followed by one of the following: core gui widget\n"); +#else + qWarning() << QCoreApplication::translate("main", "--apptype must be followed by one of the following: core gui\n"); +#endif // QT_WIDGETS_LIB + parser.showHelp(); + } + if (parser.isSet(verboseOption)) + verboseMode = true; + if (parser.isSet(quietOption)) { + quietMode = true; + verboseMode = false; + } #if QT_CONFIG(qml_animation) - else if (arg == QLatin1String("-slow-animations")) - QUnifiedTimer::instance()->setSlowModeEnabled(true); - else if (arg == QLatin1String("-fixed-animations")) - QUnifiedTimer::instance()->setConsistentTiming(true); + if (parser.isSet(slowAnimationsOption)) + QUnifiedTimer::instance()->setSlowModeEnabled(true); + if (parser.isSet(fixedAnimationsOption)) + QUnifiedTimer::instance()->setConsistentTiming(true); #endif - else if (arg == QLatin1String("-I")) { - if (i+1 == argList.count()) - continue; // Invalid usage, but just ignore it - e.addImportPath(argList[i+1]); - i++; - } else if (arg == QLatin1String("-f")) { - if (i+1 == argList.count()) - continue; // Invalid usage, but just ignore it - files << argList[i+1]; - i++; - } else if (arg == QLatin1String("-config")){ - if (i+1 == argList.count()) - continue; // Invalid usage, but just ignore it - confFile = argList[i+1]; - i++; - } else if (arg == QLatin1String("-translation")){ - if (i+1 == argList.count()) - continue; // Invalid usage, but just ignore it - translationFile = argList[i+1]; - i++; - } else if (arg == QLatin1String("-dummy-data")){ - if (i+1 == argList.count()) - continue; // Invalid usage, but just ignore it - dummyDir = argList[i+1]; - i++; - } else if (arg == QLatin1String("-gles")) { - QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); - } else if (arg == QLatin1String("-software")) { - QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); - } else if (arg == QLatin1String("-desktop")) { - QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL); - } else if (arg == QLatin1String("-scaling")) { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - } else if (arg == QLatin1String("-no-scaling")) { - QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); - } else { - files << arg; - } + if (parser.isSet(glEsOption)) + QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); + if (parser.isSet(glSoftwareOption)) + QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); + if (parser.isSet(glDesktopOption)) + QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL); + if (parser.isSet(scalingOption)) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + if (parser.isSet(noScalingOption)) + QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); + for (const QString &importPath : parser.values(importOption)) + e.addImportPath(importPath); + files << parser.values(qmlFileOption); + if (parser.isSet(configOption)) + confFile = parser.value(configOption); + if (parser.isSet(translationOption)) + translationFile = parser.value(translationOption); + if (parser.isSet(dummyDataOption)) + dummyDir = parser.value(dummyDataOption); + if (parser.isSet(rhiOption)) { + qputenv("QSG_RHI", "1"); + const QString rhiBackend = parser.value(rhiOption); + if (rhiBackend == QLatin1String("default")) + qunsetenv("QSG_RHI_BACKEND"); + else + qputenv("QSG_RHI_BACKEND", rhiBackend.toLatin1()); + } + for (QString posArg : parser.positionalArguments()) { + if (posArg == QLatin1String("--")) + break; + else + files << posArg; } - - if (quietMode && verboseMode) - verboseMode = false; #if QT_CONFIG(translation) // Need to be installed before QQmlApplicationEngine's automatic translation loading @@ -557,8 +590,10 @@ int main(int argc, char *argv[]) printf("qml: Translation file specified, but Qt built without translation support.\n"); #endif - if (quietMode) + if (quietMode) { qInstallMessageHandler(quietMessageHandler); + QLoggingCategory::setFilterRules(QStringLiteral("*=false")); + } if (files.count() <= 0) { #if defined(Q_OS_DARWIN) diff --git a/tools/qml/qml.qrc b/tools/qml/qml.qrc index e4be1793d4..69aa4a5756 100644 --- a/tools/qml/qml.qrc +++ b/tools/qml/qml.qrc @@ -1,7 +1,9 @@ <RCC> <qresource prefix="qt-project.org/QmlRuntime"> - <file>conf/configuration.qml</file> - <file>conf/qtquick.qml</file> + <file>conf/default.qml</file> + <file>conf/resizeToItem.qml</file> + <file>conf/content/resizeItemToWindow.qml</file> + <file>conf/content/resizeWindowToItem.qml</file> <file>resources/qml-64.png</file> </qresource> </RCC> diff --git a/tools/qmlcachegen/generateloader.cpp b/tools/qmlcachegen/generateloader.cpp index 4fbbb27afb..74208a25e2 100644 --- a/tools/qmlcachegen/generateloader.cpp +++ b/tools/qmlcachegen/generateloader.cpp @@ -75,7 +75,7 @@ QString mangledIdentifier(const QString &str) || (c >= QLatin1Char('a') && c <= QLatin1Char('z')) || (c >= QLatin1Char('A') && c <= QLatin1Char('Z')) || c == QLatin1Char('_')) { - mangled += c; + mangled += QChar(c); } else { mangled += QLatin1String("_0x") + QString::number(c, 16) + QLatin1Char('_'); } diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index df7468eaef..a91c181233 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -82,9 +82,9 @@ Error Error::augment(const QString &contextErrorMessage) const QString diagnosticErrorMessage(const QString &fileName, const QQmlJS::DiagnosticMessage &m) { QString message; - message = fileName + QLatin1Char(':') + QString::number(m.loc.startLine) + QLatin1Char(':'); - if (m.loc.startColumn > 0) - message += QString::number(m.loc.startColumn) + QLatin1Char(':'); + message = fileName + QLatin1Char(':') + QString::number(m.line) + QLatin1Char(':'); + if (m.column > 0) + message += QString::number(m.column) + QLatin1Char(':'); if (m.isError()) message += QLatin1String(" error: "); @@ -169,7 +169,7 @@ static bool checkArgumentsObjectUseInSignalHandlers(const QmlIR::Document &doc, return true; } -using SaveFunction = std::function<bool (const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &, QString *)>; +using SaveFunction = std::function<bool(const QV4::CompiledData::SaveableUnitPointer &, QString *)>; static bool compileQmlFile(const QString &inputFileName, SaveFunction saveFunction, Error *error) { @@ -229,11 +229,13 @@ static bool compileQmlFile(const QString &inputFileName, SaveFunction saveFuncti QmlIR::QmlUnitGenerator generator; irDocument.javaScriptCompilationUnit = v4CodeGen.generateCompilationUnit(/*generate unit*/false); generator.generate(irDocument); - QV4::CompiledData::Unit *unit = const_cast<QV4::CompiledData::Unit*>(irDocument.javaScriptCompilationUnit->data); - unit->flags |= QV4::CompiledData::Unit::StaticData; - unit->flags |= QV4::CompiledData::Unit::PendingTypeCompilation; - if (!saveFunction(irDocument.javaScriptCompilationUnit, &error->message)) + const quint32 saveFlags + = QV4::CompiledData::Unit::StaticData + | QV4::CompiledData::Unit::PendingTypeCompilation; + QV4::CompiledData::SaveableUnitPointer saveable(irDocument.javaScriptCompilationUnit.data, + saveFlags); + if (!saveFunction(saveable, &error->message)) return false; } return true; @@ -241,7 +243,7 @@ static bool compileQmlFile(const QString &inputFileName, SaveFunction saveFuncti static bool compileJSFile(const QString &inputFileName, const QString &inputFileUrl, SaveFunction saveFunction, Error *error) { - QQmlRefPointer<QV4::CompiledData::CompilationUnit> unit; + QV4::CompiledData::CompilationUnit unit; QString sourceCode; { @@ -262,9 +264,10 @@ static bool compileJSFile(const QString &inputFileName, const QString &inputFile QList<QQmlJS::DiagnosticMessage> diagnostics; // Precompiled files are relocatable and the final location will be set when loading. QString url; - unit = QV4::ExecutionEngine::compileModule(/*debugMode*/false, url, sourceCode, QDateTime(), &diagnostics); + unit = QV4::Compiler::Codegen::compileModule(/*debugMode*/false, url, sourceCode, + QDateTime(), &diagnostics); error->appendDiagnostics(inputFileName, diagnostics); - if (!unit) + if (!unit.unitData()) return false; } else { QmlIR::Document irDocument(/*debugMode*/false); @@ -320,17 +323,16 @@ static bool compileJSFile(const QString &inputFileName, const QString &inputFile irDocument.javaScriptCompilationUnit = v4CodeGen.generateCompilationUnit(/*generate unit*/false); QmlIR::QmlUnitGenerator generator; generator.generate(irDocument); - QV4::CompiledData::Unit *unitData = const_cast<QV4::CompiledData::Unit*>(irDocument.javaScriptCompilationUnit->data); - unitData->flags |= QV4::CompiledData::Unit::StaticData; - unit = irDocument.javaScriptCompilationUnit; + unit = std::move(irDocument.javaScriptCompilationUnit); } } - return saveFunction(unit, &error->message); + return saveFunction(QV4::CompiledData::SaveableUnitPointer(unit.data), &error->message); } static bool saveUnitAsCpp(const QString &inputFileName, const QString &outputFileName, - const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &unit, QString *errorString) + const QV4::CompiledData::SaveableUnitPointer &unit, + QString *errorString) { QSaveFile f(outputFileName); if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { @@ -364,35 +366,28 @@ static bool saveUnitAsCpp(const QString &inputFileName, const QString &outputFil if (!writeStr(QByteArrayLiteral(" {\nextern const unsigned char qmlData alignas(16) [] = {\n"))) return false; - QByteArray hexifiedData; - { - QByteArray modifiedUnit; - modifiedUnit.resize(unit->data->unitSize); - memcpy(modifiedUnit.data(), unit->data, unit->data->unitSize); - const char *dataPtr = modifiedUnit.data(); - QV4::CompiledData::Unit *unitPtr; - memcpy(&unitPtr, &dataPtr, sizeof(unitPtr)); - unitPtr->flags |= QV4::CompiledData::Unit::StaticData; - - QTextStream stream(&hexifiedData); - const uchar *begin = reinterpret_cast<const uchar *>(modifiedUnit.constData()); - const uchar *end = begin + unit->data->unitSize; - stream << hex; - int col = 0; - for (const uchar *data = begin; data < end; ++data, ++col) { - if (data > begin) - stream << ','; - if (col % 8 == 0) { - stream << '\n'; - col = 0; + unit.saveToDisk<uchar>([&writeStr](const uchar *begin, quint32 size) { + QByteArray hexifiedData; + { + QTextStream stream(&hexifiedData); + const uchar *end = begin + size; + stream << hex; + int col = 0; + for (const uchar *data = begin; data < end; ++data, ++col) { + if (data > begin) + stream << ','; + if (col % 8 == 0) { + stream << '\n'; + col = 0; + } + stream << "0x" << *data; } - stream << "0x" << *data; + stream << '\n'; } - stream << '\n'; - }; + return writeStr(hexifiedData); + }); + - if (!writeStr(hexifiedData)) - return false; if (!writeStr("};\n}\n}\n")) return false; @@ -524,13 +519,20 @@ int main(int argc, char **argv) inputFileUrl = QStringLiteral("qrc://") + inputResourcePath; - saveFunction = [inputResourcePath, outputFileName](const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &unit, QString *errorString) { + saveFunction = [inputResourcePath, outputFileName]( + const QV4::CompiledData::SaveableUnitPointer &unit, + QString *errorString) { return saveUnitAsCpp(inputResourcePath, outputFileName, unit, errorString); }; } else { - saveFunction = [outputFileName](const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &unit, QString *errorString) { - return unit->saveToDisk(outputFileName, errorString); + saveFunction = [outputFileName](const QV4::CompiledData::SaveableUnitPointer &unit, + QString *errorString) { + return unit.saveToDisk<char>( + [&outputFileName, errorString](const char *data, quint32 size) { + return QV4::CompiledData::SaveableUnitPointer::writeDataToFile( + outputFileName, data, size, errorString); + }); }; } diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp index 616de9e80d..ee69a0ed42 100644 --- a/tools/qmlimportscanner/main.cpp +++ b/tools/qmlimportscanner/main.cpp @@ -30,8 +30,9 @@ #include <private/qqmljsparser_p.h> #include <private/qqmljsast_p.h> #include <private/qv4codegen_p.h> -#include <private/qv4value_p.h> +#include <private/qv4staticvalue_p.h> #include <private/qqmlirbuilder_p.h> +#include <private/qqmljsdiagnosticmessage_p.h> #include <QtCore/QCoreApplication> #include <QtCore/QDir> @@ -272,7 +273,7 @@ QVariantList findQmlImportsInQmlCode(const QString &filePath, const QString &cod const auto diagnosticMessages = parser.diagnosticMessages(); for (const QQmlJS::DiagnosticMessage &m : diagnosticMessages) { std::cerr << QDir::toNativeSeparators(filePath).toStdString() << ':' - << m.loc.startLine << ':' << m.message.toStdString() << std::endl; + << m.line << ':' << m.message.toStdString() << std::endl; } return QVariantList(); } diff --git a/tools/qmljs/qmljs.cpp b/tools/qmljs/qmljs.cpp index 4b581fff05..ba5e5f553c 100644 --- a/tools/qmljs/qmljs.cpp +++ b/tools/qmljs/qmljs.cpp @@ -137,7 +137,8 @@ int main(int argc, char *argv[]) } QScopedPointer<QV4::Script> script; if (cache && QFile::exists(fn + QLatin1Char('c'))) { - QQmlRefPointer<QV4::CompiledData::CompilationUnit> unit = QV4::Compiler::Codegen::createUnitForLoading(); + QQmlRefPointer<QV4::ExecutableCompilationUnit> unit + = QV4::ExecutableCompilationUnit::create(); QString error; if (unit->loadFromDisk(QUrl::fromLocalFile(fn), QFileInfo(fn).lastModified(), &error)) { script.reset(new QV4::Script(&vm, nullptr, unit)); diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp index 791fb71685..bf0ceb54b7 100644 --- a/tools/qmllint/main.cpp +++ b/tools/qmllint/main.cpp @@ -34,7 +34,7 @@ #endif #include <QCoreApplication> -#include <private/qv4value_p.h> +#include <private/qv4staticvalue_p.h> #include <private/qqmljslexer_p.h> #include <private/qqmljsparser_p.h> #include <private/qqmljsengine_p.h> @@ -63,7 +63,7 @@ static bool lint_file(const QString &filename, bool silent) if (!success && !silent) { const auto diagnosticMessages = parser.diagnosticMessages(); for (const QQmlJS::DiagnosticMessage &m : diagnosticMessages) { - qWarning("%s:%d : %s", qPrintable(filename), m.loc.startLine, qPrintable(m.message)); + qWarning("%s:%d : %s", qPrintable(filename), m.line, qPrintable(m.message)); } } diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 0a66aa419b..464f3e8a6b 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -270,13 +270,12 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine, << " is singleton, but has no singletonInstanceInfo" << std::endl; continue; } - if (siinfo->qobjectCallback) { + if (ty.isQObjectSingleton()) { if (verbose) std::cerr << "Trying to get singleton for " << qPrintable(tyName) << " (" << qPrintable( siinfo->typeName ) << ")" << std::endl; - siinfo->init(engine); collectReachableMetaObjects(object, &metas); - object = siinfo->qobjectApi(engine); + object = QQmlEnginePrivate::get(engine)->singletonInstance<QObject*>(ty); } else { inObjectInstantiation.clear(); continue; // we don't handle QJSValue singleton types. diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index af50acaa5a..260c5bb7d1 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -29,7 +29,7 @@ #include <QtCore/qabstractanimation.h> #include <QtCore/qdir.h> #include <QtCore/qmath.h> -#include <QtCore/qdatetime.h> +#include <QtCore/qelapsedtimer.h> #include <QtCore/qpointer.h> #include <QtCore/qscopedpointer.h> #include <QtCore/qtextstream.h> @@ -76,7 +76,7 @@ QVector<int> RenderStatistics::timesPerFrames; void RenderStatistics::updateStats() { - static QTime time; + static QElapsedTimer time; static int frames; static int lastTime; @@ -169,10 +169,13 @@ struct Options bool multisample = false; bool coreProfile = false; bool verbose = false; + bool rhi = false; + bool rhiBackendSet = false; QVector<Qt::ApplicationAttribute> applicationAttributes; QString translationFile; QmlApplicationType applicationType = DefaultQmlApplicationType; QQuickWindow::TextRenderType textRenderType; + QString rhiBackend; }; #if defined(QMLSCENE_BUNDLE) @@ -271,6 +274,10 @@ static bool checkVersion(const QUrl &url) QTextStream stream(&f); bool codeFound= false; while (!codeFound) { + if (stream.atEnd()) { + fprintf(stderr, "qmlscene: no code found in file '%s'.\n", qPrintable(fileName)); + return false; + } QString line = stream.readLine(); if (line.contains(QLatin1Char('{'))) { codeFound = true; @@ -345,24 +352,26 @@ static void usage() puts(" --transparent .................... Make the window transparent"); puts(" --multisample .................... Enable multisampling (OpenGL anti-aliasing)"); puts(" --core-profile ................... Request a core profile OpenGL context"); + puts(" --rhi [vulkan|metal|d3d11|gl] .... Use the Qt graphics abstraction (RHI) instead of OpenGL directly.\n" + " .... Backend has platform specific defaults. Specify to override."); puts(" --no-version-detection ........... Do not try to detect the version of the .qml file"); puts(" --slow-animations ................ Run all animations in slow motion"); puts(" --resize-to-root ................. Resize the window to the size of the root item"); puts(" --quit ........................... Quit immediately after starting"); puts(" --disable-context-sharing ........ Disable the use of a shared GL context for QtQuick Windows\n" - " .........(remove AA_ShareOpenGLContexts)"); - puts(" --desktop..........................Force use of desktop GL (AA_UseDesktopOpenGL)"); - puts(" --gles.............................Force use of GLES (AA_UseOpenGLES)"); - puts(" --software.........................Force use of software rendering (AA_UseOpenGLES)"); - puts(" --scaling..........................Enable High DPI scaling (AA_EnableHighDpiScaling)"); - puts(" --no-scaling.......................Disable High DPI scaling (AA_DisableHighDpiScaling)"); - puts(" --verbose..........................Print version and graphical diagnostics for the run-time"); + " ........ (remove AA_ShareOpenGLContexts)"); + puts(" --desktop......................... Force use of desktop GL (AA_UseDesktopOpenGL)"); + puts(" --gles............................ Force use of GLES (AA_UseOpenGLES)"); + puts(" --software........................ Force use of software rendering (AA_UseOpenGLES)"); + puts(" --scaling......................... Enable High DPI scaling (AA_EnableHighDpiScaling)"); + puts(" --no-scaling...................... Disable High DPI scaling (AA_DisableHighDpiScaling)"); + puts(" --verbose......................... Print version and graphical diagnostics for the run-time"); #ifdef QT_WIDGETS_LIB - puts(" --apptype [gui|widgets] ...........Select which application class to use. Default is widgets."); + puts(" --apptype [gui|widgets] .......... Select which application class to use. Default is widgets."); #endif - puts(" --textrendertype [qt|native].......Select the default render type for text-like elements."); + puts(" --textrendertype [qt|native]...... Select the default render type for text-like elements."); puts(" -I <path> ........................ Add <path> to the list of import paths"); - puts(" -S <selector> .....................Add <selector> to the list of QQmlFileSelector selectors"); + puts(" -S <selector> .................... Add <selector> to the list of QQmlFileSelector selectors"); puts(" -P <path> ........................ Add <path> to the list of plugin paths"); puts(" -translation <translationfile> ... Set the language to run in"); @@ -546,7 +555,13 @@ int main(int argc, char ** argv) options.resizeViewToRootItem = true; else if (lowerArgument == QLatin1String("--verbose")) options.verbose = true; - else if (lowerArgument == QLatin1String("-i") && i + 1 < size) + else if (lowerArgument == QLatin1String("--rhi")) { + options.rhi = true; + if (i + 1 < size && !arguments.at(i + 1).startsWith(QLatin1Char('-'))) { + options.rhiBackendSet = true; + options.rhiBackend = arguments.at(++i); + } + } else if (lowerArgument == QLatin1String("-i") && i + 1 < size) imports.append(arguments.at(++i)); else if (lowerArgument == QLatin1String("-s") && i + 1 < size) customSelectors.append(arguments.at(++i)); @@ -588,6 +603,14 @@ int main(int argc, char ** argv) QUnifiedTimer::instance()->setSlowModeEnabled(options.slowAnimations); + if (options.rhi) { + qputenv("QSG_RHI", "1"); + if (options.rhiBackendSet) + qputenv("QSG_RHI_BACKEND", options.rhiBackend.toLatin1()); + else + qunsetenv("QSG_RHI_BACKEND"); + } + if (options.url.isEmpty()) #if defined(QMLSCENE_BUNDLE) displayOptionsDialog(&options); @@ -692,6 +715,8 @@ int main(int argc, char ** argv) // QQuickView if one was created. That case is tracked by // QPointer, so it is safe to delete the component here. delete component; + } else { + exitCode = 1; } } diff --git a/tools/qmltime/qmltime.cpp b/tools/qmltime/qmltime.cpp index b897d304fc..7baedff611 100644 --- a/tools/qmltime/qmltime.cpp +++ b/tools/qmltime/qmltime.cpp @@ -29,7 +29,7 @@ #include <QQmlComponent> #include <QDebug> #include <QGuiApplication> -#include <QTime> +#include <QElapsedTimer> #include <QQmlContext> #include <QQuickView> #include <QQuickItem> @@ -119,7 +119,7 @@ void Timer::setWillParent(bool p) void Timer::runTest(QQmlContext *context, uint iterations) { - QTime t; + QElapsedTimer t; t.start(); for (uint ii = 0; ii < iterations; ++ii) { QObject *o = m_component->create(context); diff --git a/tools/tools.pro b/tools/tools.pro index 73cb6e2293..25ed760903 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -10,7 +10,7 @@ qtConfig(qml-devtools) { qtConfig(commandlineparser):qtConfig(xmlstreamwriter): SUBDIRS += qmlcachegen } -qtConfig(thread):!android|android_app:!wasm { +qtConfig(thread):!android|android_app:!wasm:!rtems { SUBDIRS += \ qml |