Allow adding additional QML import paths via environment variable

This is useful to use a custom build of kirigami.
This commit is contained in:
Martchus 2022-05-02 21:08:31 +02:00
parent a8364be203
commit 25ef1dbe91
1 changed files with 6 additions and 0 deletions

View File

@ -95,6 +95,12 @@ int runQuickGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs, c
context->setContextProperty(QStringLiteral("app"), &application);
context->setContextProperty(QStringLiteral("description"), QStringLiteral(APP_DESCRIPTION));
context->setContextProperty(QStringLiteral("dependencyVersions"), QStringList(DEPENCENCY_VERSIONS));
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
const auto importPaths = qEnvironmentVariable(PROJECT_VARNAME_UPPER "_QML_IMPORT_PATHS").split(QChar(':'));
for (const auto &path : importPaths) {
engine.addImportPath(path);
}
#endif
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
// run event loop