aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qml
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-03-10 15:09:37 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-03-12 15:03:03 +0100
commit26c5243491f495194f04b449128dae36118e28da (patch)
tree7fb14678a6fc9e44a10c9224d005e2cbdc6bcb63 /tools/qml
parent1c7d264e3b2e9a2f0021786ea6967185f8282af0 (diff)
parentc24c5baeda4101b0058689adf9200b77a722c3a2 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts: dependencies.yaml src/qml/qml/qqmlengine.cpp Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
Diffstat (limited to 'tools/qml')
-rw-r--r--tools/qml/conf.h2
-rw-r--r--tools/qml/main.cpp26
-rw-r--r--tools/qml/qml.pro4
3 files changed, 31 insertions, 1 deletions
diff --git a/tools/qml/conf.h b/tools/qml/conf.h
index 4ad45428ed..84167c9134 100644
--- a/tools/qml/conf.h
+++ b/tools/qml/conf.h
@@ -40,6 +40,7 @@ class PartialScene : public QObject
Q_PROPERTY(QUrl container READ container WRITE setContainer NOTIFY containerChanged)
Q_PROPERTY(QString itemType READ itemType WRITE setItemType NOTIFY itemTypeChanged)
QML_ELEMENT
+ QML_ADDED_IN_VERSION(1, 0)
public:
PartialScene(QObject *parent = 0) : QObject(parent)
{}
@@ -75,6 +76,7 @@ class Config : public QObject
Q_PROPERTY(QQmlListProperty<PartialScene> sceneCompleters READ sceneCompleters)
Q_CLASSINFO("DefaultProperty", "sceneCompleters")
QML_NAMED_ELEMENT(Configuration)
+ QML_ADDED_IN_VERSION(1, 0)
public:
Config (QObject* parent=0) : QObject(parent)
{}
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 618dab6690..e8c471e22e 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -37,6 +37,7 @@
#include <QFileOpenEvent>
#include <QOpenGLContext>
#include <QOpenGLFunctions>
+#include <QSurfaceFormat>
#ifdef QT_WIDGETS_LIB
#include <QApplication>
#endif // QT_WIDGETS_LIB
@@ -59,6 +60,7 @@
#include <QLibraryInfo>
#include <qqml.h>
#include <qqmldebug.h>
+#include <qqmlfileselector.h>
#include <private/qmemory_p.h>
#include <private/qtqmlglobal_p.h>
@@ -434,7 +436,6 @@ int main(int argc, char *argv[])
app->setOrganizationDomain("qt-project.org");
QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
- qmlRegisterTypesAndRevisions<Config, PartialScene>("QmlRuntime.Config", 1);
QQmlApplicationEngine e;
QStringList files;
QString confFile;
@@ -511,6 +512,9 @@ int main(int argc, char *argv[])
"Backend is one of: default, vulkan, metal, d3d11, gl"),
QStringLiteral("backend"));
parser.addOption(rhiOption);
+ QCommandLineOption selectorOption(QStringLiteral("S"), QCoreApplication::translate("main",
+ "Add selector to the list of QQmlFileSelectors."), QStringLiteral("selector"));
+ parser.addOption(selectorOption);
// Positional arguments
parser.addPositionalArgument("files",
@@ -550,6 +554,26 @@ int main(int argc, char *argv[])
#endif
for (const QString &importPath : parser.values(importOption))
e.addImportPath(importPath);
+
+ QStringList customSelectors;
+ for (const QString &selector : parser.values(selectorOption))
+ customSelectors.append(selector);
+ if (!customSelectors.isEmpty()) {
+ QQmlFileSelector *selector = QQmlFileSelector::get(&e);
+ selector->setExtraSelectors(customSelectors);
+ }
+
+#if defined(QT_GUI_LIB) && QT_CONFIG(opengl)
+ if (qEnvironmentVariableIsSet("QSG_CORE_PROFILE") || qEnvironmentVariableIsSet("QML_CORE_PROFILE")) {
+ QSurfaceFormat surfaceFormat;
+ surfaceFormat.setStencilBufferSize(8);
+ surfaceFormat.setDepthBufferSize(24);
+ surfaceFormat.setVersion(4, 1);
+ surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
+ QSurfaceFormat::setDefaultFormat(surfaceFormat);
+ }
+#endif
+
files << parser.values(qmlFileOption);
if (parser.isSet(configOption))
confFile = parser.value(configOption);
diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro
index 5dcbb3567a..83e2e1bf80 100644
--- a/tools/qml/qml.pro
+++ b/tools/qml/qml.pro
@@ -5,6 +5,10 @@ qtHaveModule(widgets): QT += widgets
HEADERS += conf.h
SOURCES += main.cpp
RESOURCES += qml.qrc
+CONFIG += qmltypes
+
+QML_IMPORT_NAME = QmlRuntime.Config
+QML_IMPORT_VERSION = 1.0
QMAKE_TARGET_DESCRIPTION = QML Runtime