aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-05-02 15:13:49 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-05-02 15:14:36 +0200
commit44ca7e31ee9365a72cd17ecd335ec4d0161420a9 (patch)
treec03b4f8263b41986b6f5d4ac9c6e35e371e98a33 /tools
parent580fa7dc88aae23053e44ffa335a15f6af112a20 (diff)
parent325e6305b418ffe1dfb9a36c2516c6a8a3de5733 (diff)
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Diffstat (limited to 'tools')
-rw-r--r--tools/qml/conf/content/resizeItemToWindow.qml70
-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.qml57
-rw-r--r--tools/qml/main.cpp370
-rw-r--r--tools/qml/qml.icnsbin196156 -> 0 bytes
-rw-r--r--tools/qml/qml.pro10
-rw-r--r--tools/qml/qml.qrc7
-rw-r--r--tools/qml/resources/Info.plist (renamed from tools/qml/Info.plist)0
-rw-r--r--tools/qml/resources/qml-64.pngbin0 -> 2304 bytes
-rw-r--r--tools/qml/resources/qml.icnsbin0 -> 194026 bytes
-rw-r--r--tools/qml/resources/qml.icobin0 -> 124455 bytes
-rw-r--r--tools/qmlcachegen/qtquickcompiler.prf2
-rw-r--r--tools/qmlplugindump/main.cpp5
-rw-r--r--tools/qmlscene/main.cpp6
15 files changed, 349 insertions, 188 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 166c6aabdf..1e367d91bf 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,22 +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()) {
@@ -91,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
@@ -127,15 +156,32 @@ 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
{
public:
- LoaderApplication(int& argc, char **argv) : QGuiApplication(argc, argv) {}
+ LoaderApplication(int& argc, char **argv) : QGuiApplication(argc, argv)
+ {
+ setWindowIcon(QIcon(iconResourcePath));
+ }
bool event(QEvent *ev) override
{
@@ -175,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)
@@ -217,8 +263,8 @@ private:
void checkForWindow(QObject *o);
private:
- int expectedFileCount;
bool haveWindow = false;
+ int expectedFileCount;
};
void LoadWatcher::contain(QObject *o, const QUrl &containPath)
@@ -278,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"))
@@ -376,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;
@@ -438,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);
@@ -448,11 +407,14 @@ int main(int argc, char *argv[])
#ifdef QT_WIDGETS_LIB
case QmlApplicationTypeWidget:
app = new QApplication(argc, argv);
+ static_cast<QApplication *>(app)->setWindowIcon(QIcon(iconResourcePath));
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;
}
@@ -470,68 +432,130 @@ 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);
+ // 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);
+ 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
// (qt_ translations are loaded there)
@@ -552,8 +576,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.icns b/tools/qml/qml.icns
deleted file mode 100644
index c76051626a..0000000000
--- a/tools/qml/qml.icns
+++ /dev/null
Binary files differ
diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro
index 3f41707275..f086b7bff9 100644
--- a/tools/qml/qml.pro
+++ b/tools/qml/qml.pro
@@ -8,10 +8,14 @@ RESOURCES += qml.qrc
QMAKE_TARGET_DESCRIPTION = QML Runtime
+ICON = resources/qml64.png
+win32 {
+ RC_ICONS = resources/qml.ico
+}
mac {
- OTHER_FILES += Info.plist
- QMAKE_INFO_PLIST = Info.plist
- ICON = qml.icns
+ OTHER_FILES += resources/Info.plist
+ QMAKE_INFO_PLIST = resources/Info.plist
+ ICON = resources/qml.icns
}
qtConfig(qml-debug): DEFINES += QT_QML_DEBUG_NO_WARNING
diff --git a/tools/qml/qml.qrc b/tools/qml/qml.qrc
index 1f0ffdace2..69aa4a5756 100644
--- a/tools/qml/qml.qrc
+++ b/tools/qml/qml.qrc
@@ -1,6 +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/qml/Info.plist b/tools/qml/resources/Info.plist
index 567c5bf8fd..567c5bf8fd 100644
--- a/tools/qml/Info.plist
+++ b/tools/qml/resources/Info.plist
diff --git a/tools/qml/resources/qml-64.png b/tools/qml/resources/qml-64.png
new file mode 100644
index 0000000000..83dbeab9af
--- /dev/null
+++ b/tools/qml/resources/qml-64.png
Binary files differ
diff --git a/tools/qml/resources/qml.icns b/tools/qml/resources/qml.icns
new file mode 100644
index 0000000000..b092ffd943
--- /dev/null
+++ b/tools/qml/resources/qml.icns
Binary files differ
diff --git a/tools/qml/resources/qml.ico b/tools/qml/resources/qml.ico
new file mode 100644
index 0000000000..09ec5ccece
--- /dev/null
+++ b/tools/qml/resources/qml.ico
Binary files differ
diff --git a/tools/qmlcachegen/qtquickcompiler.prf b/tools/qmlcachegen/qtquickcompiler.prf
index 9c8c7a7b1e..2f98aadefe 100644
--- a/tools/qmlcachegen/qtquickcompiler.prf
+++ b/tools/qmlcachegen/qtquickcompiler.prf
@@ -1,4 +1,4 @@
-qtc_run: return()
+if(qtc_run|lupdate_run): return()
qtPrepareTool(QML_CACHEGEN, qmlcachegen, _FILTER)
qtPrepareTool(QMAKE_RCC, rcc, _DEP)
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index f3b931fbbf..ccdab57cfc 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 867267c821..d64272d417 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -499,6 +499,9 @@ 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('-'))) {
@@ -525,8 +528,7 @@ int main(int argc, char ** argv)
options.resizeViewToRootItem = true;
else if (lowerArgument == QLatin1String("--multisample"))
options.multisample = true;
- else if (lowerArgument == QLatin1String("--core-profile")
- || qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE"))
+ else if (lowerArgument == QLatin1String("--core-profile"))
options.coreProfile = true;
else if (lowerArgument == QLatin1String("--verbose"))
options.verbose = true;