aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/.prev_CMakeLists.txt2
-rw-r--r--tools/CMakeLists.txt2
-rw-r--r--tools/qml/main.cpp14
-rw-r--r--tools/qmlcachegen/generateloader.cpp9
-rw-r--r--tools/qmlcachegen/qmlcachegen.cpp78
-rw-r--r--tools/qmlcachegen/resourcefilemapper.cpp4
-rw-r--r--tools/qmlimportscanner/main.cpp10
-rw-r--r--tools/qmllint/main.cpp2
-rw-r--r--tools/qmlplugindump/main.cpp6
-rw-r--r--tools/qmlpreview/qmlpreviewapplication.cpp4
-rw-r--r--tools/qmlscene/main.cpp95
-rw-r--r--tools/qmltime/qmltime.cpp4
-rw-r--r--tools/tools.pro2
13 files changed, 145 insertions, 87 deletions
diff --git a/tools/.prev_CMakeLists.txt b/tools/.prev_CMakeLists.txt
index 2278b7ff0d..0233f2e8d0 100644
--- a/tools/.prev_CMakeLists.txt
+++ b/tools/.prev_CMakeLists.txt
@@ -11,7 +11,7 @@ if(QT_FEATURE_qml_devtools)
endif()
endif()
-if(QT_FEATURE_thread AND NOT ANDROID OR android_app AND NOT WASM)
+if(QT_FEATURE_thread AND NOT ANDROID OR android_app AND NOT WASM AND NOT rtems)
add_subdirectory(qml)
if(QT_FEATURE_qml_profiler)
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 78e64b2d04..19444b3bf1 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -11,7 +11,7 @@ if(QT_FEATURE_qml_devtools)
endif()
endif()
-if(QT_FEATURE_thread AND NOT ANDROID OR android_app AND NOT WASM)
+if(QT_FEATURE_thread AND NOT ANDROID OR android_app AND NOT WASM AND NOT rtems)
add_subdirectory(qml)
if(QT_FEATURE_qml_profiler)
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 1e367d91bf..9edc90e050 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -494,6 +494,12 @@ int main(int argc, char *argv[])
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...]");
@@ -549,6 +555,14 @@ int main(int argc, char *argv[])
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;
diff --git a/tools/qmlcachegen/generateloader.cpp b/tools/qmlcachegen/generateloader.cpp
index 5b8fc34455..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('_');
}
@@ -365,6 +365,7 @@ bool generateLoader(const QStringList &compiledFiles, const QStringList &sortedR
stream << "struct Registry {\n";
stream << " Registry();\n";
+ stream << " ~Registry();\n";
stream << " QHash<QString, const QQmlPrivate::CachedQmlUnit*> resourcePathToCachedUnit;\n";
stream << " static const QQmlPrivate::CachedQmlUnit *lookupCachedUnit(const QUrl &url);\n";
stream << "};\n\n";
@@ -387,7 +388,11 @@ bool generateLoader(const QStringList &compiledFiles, const QStringList &sortedR
if (!resourceRegisterCall.isEmpty())
stream << resourceRegisterCall;
- stream << "}\n";
+ stream << "}\n\n";
+ stream << "Registry::~Registry() {\n";
+ stream << " QQmlPrivate::qmlunregister(QQmlPrivate::QmlUnitCacheHookRegistration, quintptr(&lookupCachedUnit));\n";
+ stream << "}\n\n";
+
stream << "const QQmlPrivate::CachedQmlUnit *Registry::lookupCachedUnit(const QUrl &url) {\n";
stream << " if (url.scheme() != QLatin1String(\"qrc\"))\n";
stream << " return nullptr;\n";
diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp
index 7b4135e1f8..abad2435dc 100644
--- a/tools/qmlcachegen/qmlcachegen.cpp
+++ b/tools/qmlcachegen/qmlcachegen.cpp
@@ -65,6 +65,7 @@ struct Error
void print();
Error augment(const QString &contextErrorMessage) const;
void appendDiagnostics(const QString &inputFileName, const QList<QQmlJS::DiagnosticMessage> &diagnostics);
+ void appendDiagnostic(const QString &inputFileName, const DiagnosticMessage &diagnostic);
};
void Error::print()
@@ -82,9 +83,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: ");
@@ -94,13 +95,17 @@ QString diagnosticErrorMessage(const QString &fileName, const QQmlJS::Diagnostic
return message;
}
+void Error::appendDiagnostic(const QString &inputFileName, const DiagnosticMessage &diagnostic)
+{
+ if (!message.isEmpty())
+ message += QLatin1Char('\n');
+ message += diagnosticErrorMessage(inputFileName, diagnostic);
+}
+
void Error::appendDiagnostics(const QString &inputFileName, const QList<DiagnosticMessage> &diagnostics)
{
- for (const QQmlJS::DiagnosticMessage &parseError: diagnostics) {
- if (!message.isEmpty())
- message += QLatin1Char('\n');
- message += diagnosticErrorMessage(inputFileName, parseError);
- }
+ for (const QQmlJS::DiagnosticMessage &diagnostic: diagnostics)
+ appendDiagnostic(inputFileName, diagnostic);
}
// Ensure that ListElement objects keep all property assignments in their string form
@@ -211,9 +216,8 @@ static bool compileQmlFile(const QString &inputFileName, SaveFunction saveFuncti
for (QmlIR::CompiledFunctionOrExpression *foe = object->functionsAndExpressions->first; foe; foe = foe->next)
functionsToCompile << *foe;
const QVector<int> runtimeFunctionIndices = v4CodeGen.generateJSCodeForFunctionsAndBindings(functionsToCompile);
- QList<QQmlJS::DiagnosticMessage> jsErrors = v4CodeGen.errors();
- if (!jsErrors.isEmpty()) {
- error->appendDiagnostics(inputFileName, jsErrors);
+ if (v4CodeGen.hasError()) {
+ error->appendDiagnostic(inputFileName, v4CodeGen.error());
return false;
}
@@ -233,7 +237,7 @@ static bool compileQmlFile(const QString &inputFileName, SaveFunction saveFuncti
const quint32 saveFlags
= QV4::CompiledData::Unit::StaticData
| QV4::CompiledData::Unit::PendingTypeCompilation;
- QV4::CompiledData::SaveableUnitPointer saveable(&irDocument.javaScriptCompilationUnit,
+ QV4::CompiledData::SaveableUnitPointer saveable(irDocument.javaScriptCompilationUnit.data,
saveFlags);
if (!saveFunction(saveable, &error->message))
return false;
@@ -310,9 +314,8 @@ static bool compileJSFile(const QString &inputFileName, const QString &inputFile
irDocument.program, &irDocument.jsGenerator.stringTable, illegalNames);
v4CodeGen.generateFromProgram(inputFileName, inputFileUrl, sourceCode, program,
&irDocument.jsModule, QV4::Compiler::ContextType::ScriptImportedByQML);
- QList<QQmlJS::DiagnosticMessage> jsErrors = v4CodeGen.errors();
- if (!jsErrors.isEmpty()) {
- error->appendDiagnostics(inputFileName, jsErrors);
+ if (v4CodeGen.hasError()) {
+ error->appendDiagnostic(inputFileName, v4CodeGen.error());
return false;
}
@@ -327,7 +330,7 @@ static bool compileJSFile(const QString &inputFileName, const QString &inputFile
}
}
- return saveFunction(QV4::CompiledData::SaveableUnitPointer(&unit), &error->message);
+ return saveFunction(QV4::CompiledData::SaveableUnitPointer(unit.data), &error->message);
}
static bool saveUnitAsCpp(const QString &inputFileName, const QString &outputFileName,
@@ -366,27 +369,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;
- {
- QTextStream stream(&hexifiedData);
- const uchar *begin = unit.data<uchar>();
- const uchar *end = begin + unit.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;
+ unit.saveToDisk<uchar>([&writeStr](const uchar *begin, quint32 size) {
+ QByteArray hexifiedData;
+ {
+ QTextStream stream(&hexifiedData);
+ const uchar *end = begin + size;
+ stream << Qt::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;
@@ -527,7 +531,11 @@ int main(int argc, char **argv)
} else {
saveFunction = [outputFileName](const QV4::CompiledData::SaveableUnitPointer &unit,
QString *errorString) {
- return unit->saveToDisk(outputFileName, 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/qmlcachegen/resourcefilemapper.cpp b/tools/qmlcachegen/resourcefilemapper.cpp
index 6a00b39f2e..244874717f 100644
--- a/tools/qmlcachegen/resourcefilemapper.cpp
+++ b/tools/qmlcachegen/resourcefilemapper.cpp
@@ -50,10 +50,8 @@ bool ResourceFileMapper::isEmpty() const
QStringList ResourceFileMapper::resourcePaths(const QString &fileName)
{
const QString absPath = QDir::cleanPath(QDir::current().absoluteFilePath(fileName));
- QHashIterator<QString, QString> it(qrcPathToFileSystemPath);
QStringList resourcePaths;
- while (it.hasNext()) {
- it.next();
+ for (auto it = qrcPathToFileSystemPath.cbegin(), end = qrcPathToFileSystemPath.cend(); it != end; ++it) {
if (QFileInfo(it.value()) == QFileInfo(absPath))
resourcePaths.append(it.key());
}
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp
index 57aeeee0a9..05d1f7fdc0 100644
--- a/tools/qmlimportscanner/main.cpp
+++ b/tools/qmlimportscanner/main.cpp
@@ -32,6 +32,7 @@
#include <private/qv4codegen_p.h>
#include <private/qv4staticvalue_p.h>
#include <private/qqmlirbuilder_p.h>
+#include <private/qqmljsdiagnosticmessage_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
@@ -85,7 +86,7 @@ void printUsage(const QString &appNameIn)
<< '\n';
}
-QVariantList findImportsInAst(QQmlJS::AST::UiHeaderItemList *headerItemList, const QString &code, const QString &path)
+QVariantList findImportsInAst(QQmlJS::AST::UiHeaderItemList *headerItemList, const QString &path)
{
QVariantList imports;
@@ -119,7 +120,8 @@ QVariantList findImportsInAst(QQmlJS::AST::UiHeaderItemList *headerItemList, con
if (!name.isEmpty())
import[nameLiteral()] = name;
import[typeLiteral()] = moduleLiteral();
- import[versionLiteral()] = code.mid(importNode->versionToken.offset, importNode->versionToken.length);
+ auto versionString = importNode->version ? QString::number(importNode->version->majorVersion) + QLatin1Char('.') + QString::number(importNode->version->minorVersion) : QString();
+ import[versionLiteral()] = versionString;
}
imports.append(import);
@@ -272,11 +274,11 @@ 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();
}
- return findImportsInAst(parser.ast()->headers, code, filePath);
+ return findImportsInAst(parser.ast()->headers, filePath);
}
// Scan a single qml file for import statements
diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp
index 0fdc3e0130..bf0ceb54b7 100644
--- a/tools/qmllint/main.cpp
+++ b/tools/qmllint/main.cpp
@@ -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 ccdab57cfc..464f3e8a6b 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -478,8 +478,12 @@ public:
}
}
- for (const QMetaObject *meta : qAsConst(objectsToMerge))
+ for (const QMetaObject *meta : qAsConst(objectsToMerge)) {
+ for (int index = meta->enumeratorOffset(); index < meta->enumeratorCount(); ++index)
+ dump(meta->enumerator(index));
+
writeMetaContent(meta, &knownAttributes);
+ }
qml->writeEndObject();
}
diff --git a/tools/qmlpreview/qmlpreviewapplication.cpp b/tools/qmlpreview/qmlpreviewapplication.cpp
index 17017dae77..2568425573 100644
--- a/tools/qmlpreview/qmlpreviewapplication.cpp
+++ b/tools/qmlpreview/qmlpreviewapplication.cpp
@@ -195,7 +195,7 @@ void QmlPreviewApplication::processFinished()
void QmlPreviewApplication::logError(const QString &error)
{
QTextStream err(stderr);
- err << "Error: " << error << endl;
+ err << "Error: " << error << Qt::endl;
}
void QmlPreviewApplication::logStatus(const QString &status)
@@ -203,7 +203,7 @@ void QmlPreviewApplication::logStatus(const QString &status)
if (!m_verbose)
return;
QTextStream err(stderr);
- err << status << endl;
+ err << status << Qt::endl;
}
void QmlPreviewApplication::serveRequest(const QString &path)
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index d64272d417..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");
@@ -477,6 +486,12 @@ int main(int argc, char ** argv)
options.applicationAttributes.append(Qt::AA_EnableHighDpiScaling);
} else if (!qstrcmp(arg, "--no-scaling")) {
options.applicationAttributes.append(Qt::AA_DisableHighDpiScaling);
+ } else if (!qstrcmp(arg, "--transparent")) {
+ options.transparent = true;
+ } else if (!qstrcmp(arg, "--multisample")) {
+ options.multisample = true;
+ } else if (!qstrcmp(arg, "--core-profile")) {
+ options.coreProfile = true;
} else if (!qstrcmp(arg, "--apptype")) {
if (++i >= argc)
usage();
@@ -485,6 +500,23 @@ int main(int argc, char ** argv)
}
}
+ if (qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE"))
+ options.coreProfile = true;
+
+ // Set default surface format before creating the window
+ QSurfaceFormat surfaceFormat;
+ surfaceFormat.setStencilBufferSize(8);
+ surfaceFormat.setDepthBufferSize(24);
+ if (options.multisample)
+ surfaceFormat.setSamples(16);
+ if (options.transparent)
+ surfaceFormat.setAlphaBufferSize(8);
+ if (options.coreProfile) {
+ surfaceFormat.setVersion(4, 1);
+ surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
+ }
+ QSurfaceFormat::setDefaultFormat(surfaceFormat);
+
for (Qt::ApplicationAttribute a : qAsConst(options.applicationAttributes))
QCoreApplication::setAttribute(a);
QScopedPointer<QGuiApplication> app;
@@ -499,9 +531,6 @@ int main(int argc, char ** argv)
QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
- if (qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE"))
- options.coreProfile = true;
-
const QStringList arguments = QCoreApplication::arguments();
for (int i = 1, size = arguments.size(); i < size; ++i) {
if (!arguments.at(i).startsWith(QLatin1Char('-'))) {
@@ -512,8 +541,6 @@ int main(int argc, char ** argv)
options.maximized = true;
else if (lowerArgument == QLatin1String("--fullscreen"))
options.fullscreen = true;
- else if (lowerArgument == QLatin1String("--transparent"))
- options.transparent = true;
else if (lowerArgument == QLatin1String("--clip"))
options.clip = true;
else if (lowerArgument == QLatin1String("--no-version-detection"))
@@ -526,13 +553,15 @@ int main(int argc, char ** argv)
options.translationFile = QLatin1String(argv[++i]);
else if (lowerArgument == QLatin1String("--resize-to-root"))
options.resizeViewToRootItem = true;
- else if (lowerArgument == QLatin1String("--multisample"))
- options.multisample = true;
- else if (lowerArgument == QLatin1String("--core-profile"))
- options.coreProfile = 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));
@@ -574,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);
@@ -623,18 +660,6 @@ int main(int argc, char ** argv)
return -1;
}
- // Set default surface format before creating the window
- QSurfaceFormat surfaceFormat;
- if (options.multisample)
- surfaceFormat.setSamples(16);
- if (options.transparent)
- surfaceFormat.setAlphaBufferSize(8);
- if (options.coreProfile) {
- surfaceFormat.setVersion(4, 1);
- surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
- }
- QSurfaceFormat::setDefaultFormat(surfaceFormat);
-
QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(topLevel));
if (window) {
engine.setIncubationController(window->incubationController());
@@ -690,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