From 0dd40a41d68bf6d1b22baa8782e30e235e4cb5b8 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 29 Aug 2024 14:11:52 +0200 Subject: [PATCH] QmlProject: Delay the opening of the fake project There are cases e.g. when restarting QDS when the correct .qmlproject will be opened anyway. Task-number: QDS-13495 Change-Id: I04e13d148484c3afa8e08fe2a43eb700c615720a Reviewed-by: Burak Hancerli Reviewed-by: Thomas Hartmann --- src/plugins/qmlprojectmanager/qmlprojectplugin.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp index 2f8ce7c7f42..d195c2b5e4a 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp @@ -409,10 +409,16 @@ void QmlProjectPlugin::initialize() [](Core::IDocument *document) { if (!ProjectManager::startupProject() && document->filePath().completeSuffix() == "ui.qml") { - const Utils::FilePath fileName = Utils::FilePath::fromString( - document->filePath().toString() + Constants::fakeProjectName); - auto result = ProjectExplorer::ProjectExplorerPlugin::openProjects({fileName}); - QTC_ASSERT(result.project(), return); + QTimer::singleShot(1000, [document]() { + if (ProjectManager::startupProject()) + return; + + const Utils::FilePath fileName = Utils::FilePath::fromString( + document->filePath().toString() + Constants::fakeProjectName); + auto result = ProjectExplorer::ProjectExplorerPlugin::openProjects( + {fileName}); + QTC_ASSERT(result.project(), return); + }); } });