1 diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
2 index 289f11d006..9b0a48c6c7 100644
3 --- a/src/qml/qml/qqmlimport.cpp
4 +++ b/src/qml/qml/qqmlimport.cpp
5 @@ -1897,17 +1897,22 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
6 addImportPath(installImportsPath);
9 - if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
10 - const QString envImportPath = qEnvironmentVariable("QML2_IMPORT_PATH");
11 + auto addEnvImportPath = [this](const char *var) {
13 QLatin1Char pathSep(';');
15 QLatin1Char pathSep(':');
17 - QStringList paths = envImportPath.split(pathSep, Qt::SkipEmptyParts);
18 - for (int ii = paths.count() - 1; ii >= 0; --ii)
19 - addImportPath(paths.at(ii));
21 + if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty(var))) {
22 + const QString envImportPath = qEnvironmentVariable(var);
23 + QStringList paths = envImportPath.split(pathSep, Qt::SkipEmptyParts);
24 + for (int ii = paths.count() - 1; ii >= 0; --ii)
25 + addImportPath(paths.at(ii));
29 + addEnvImportPath("QML2_IMPORT_PATH");
30 + addEnvImportPath("NIXPKGS_QT5_QML_IMPORT_PATH");
32 addImportPath(QStringLiteral("qrc:/qt-project.org/imports"));
33 addImportPath(QCoreApplication::applicationDirPath());