From 3d47a0ef09c899458656681dd0d470b24c35909d Mon Sep 17 00:00:00 2001 From: Maximilian Goldstein Date: Mon, 6 Dec 2021 17:13:19 +0100 Subject: [PATCH] qmljsmodelmanager: Add additional directories to find qmltypes This works around the issue that we only looked for qmltypes in the directory the binary ends up being stored in. This did not work for macOS and Windows as those are stored in subdirectories due the platform specific ways binaries are stored there. Now we also look in the directory where the qmltypes should be located on these platforms. Task-number: QTCREATORBUG-24987 Change-Id: I23d46e68f8fad0b4e2e8a01fc7c41360f1e6961e Reviewed-by: Fabian Kosmale --- src/plugins/qmljstools/qmljsmodelmanager.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 1f6d7e6a5ca..0236c3991cb 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -142,6 +142,17 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject( if (target.targetFilePath.isEmpty()) continue; projectInfo.applicationDirectories.append(target.targetFilePath.parentDir().toString()); +#if defined(Q_OS_WIN) + // On Windows systems QML type information is located one directory higher as we build + // in dedicated "debug" and "release" directories + projectInfo.applicationDirectories.append( + target.targetFilePath.parentDir().parentDir().toString()); +#elif defined(Q_OS_MACOS) + // On macOS this is not the case but the targetFilePath is within the bundle so we have + // to go up through all three additional directories (BundleName.app/Contents/MacOS) + projectInfo.applicationDirectories.append( + target.targetFilePath.parentDir().parentDir().parentDir().parentDir().toString()); +#endif } } if (qtVersion && qtVersion->isValid()) {