From 9bd33dc7a17996a7f3844e3f28040ccd27da2830 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 11 Mar 2022 17:24:12 +0100 Subject: qqmlimport: Log when no qmldir file is found Also log when it is found, with the path where it is found. As a drive-by, add a 'version' label before printing the version of an imported library. In a static build where some libraries end up with a version set to 'invalid', it's clearer that the version is invalid, and not the library. Change-Id: I998776b13bfe98f1668790419f1102e081878c99 Reviewed-by: Ulf Hermann (cherry picked from commit 22b69dae253981b67124fc38adab666eb2d750be) Reviewed-by: Qt Cherry-pick Bot --- src/qml/qml/qqmlimport.cpp | 2 +- src/qml/qml/qqmlimport_p.h | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 3967ccc970..58ffb8c3a1 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1637,7 +1637,7 @@ QTypeRevision QQmlImports::addLibraryImport( qCDebug(lcQmlImport) << "addLibraryImport:" << qPrintable(baseUrl().toString()) - << uri << version << "as" << prefix; + << uri << "version '" << version << "'" << "as" << prefix; return d->addLibraryImport(uri, prefix, version, qmldirIdentifier, qmldirUrl, flags, importDb, errors); diff --git a/src/qml/qml/qqmlimport_p.h b/src/qml/qml/qqmlimport_p.h index 5ebd7f2a2e..ba0b6286fd 100644 --- a/src/qml/qml/qqmlimport_p.h +++ b/src/qml/qml/qqmlimport_p.h @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -73,6 +74,8 @@ class QQmlImportDatabase; class QQmlTypeLoader; class QQmlTypeLoaderQmldirContent; +const QLoggingCategory &lcQmlImport(); + namespace QQmlImport { enum RecursionRestriction { PreventRecursion, AllowRecursion }; } @@ -320,6 +323,7 @@ QQmlImportDatabase::LocalQmldirResult QQmlImportDatabase::locateLocalQmldir( const QStringList qmlDirPaths = QQmlImports::completeQmldirPaths( uri, localImportPaths, version); + QString qmldirAbsoluteFilePath; for (QString qmldirPath : qmlDirPaths) { if (hasInterceptors) { const QUrl intercepted = engine->interceptUrl( @@ -333,7 +337,7 @@ QQmlImportDatabase::LocalQmldirResult QQmlImportDatabase::locateLocalQmldir( } } - QString qmldirAbsoluteFilePath = absoluteFilePath(qmldirPath); + qmldirAbsoluteFilePath = absoluteFilePath(qmldirPath); if (!qmldirAbsoluteFilePath.isEmpty()) { QString url; const QString absolutePath = qmldirAbsoluteFilePath.left( @@ -380,6 +384,15 @@ QQmlImportDatabase::LocalQmldirResult QQmlImportDatabase::locateLocalQmldir( cache->qmldirPathUrl = QStringLiteral("intercepted"); } qmldirCache.insert(uri, cache); + + if (result == QmldirNotFound) { + qCDebug(lcQmlImport) + << "locateLocalQmldir:" << qPrintable(uri) << "module's qmldir file not found"; + } + } else { + qCDebug(lcQmlImport) + << "locateLocalQmldir:" << qPrintable(uri) << "module's qmldir found at" + << qmldirAbsoluteFilePath; } return result; -- cgit v1.2.3