From 1393aa85055504cbc9a85a7c8cf52363b3186c86 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 3 Sep 2021 14:58:42 +0200 Subject: [PATCH] QmlProject: Open the first .ui.qml file in QDS Open the first .ui.qml file of a .qmlproject to not confuse users. Task-number: QDS-4986 Change-Id: I56c77c2101fd549cb7b96ea7d273bb4f5234693a Reviewed-by: Aleksei German Reviewed-by: Tim Jenssen Reviewed-by: Qt CI Bot --- src/plugins/qmlprojectmanager/qmlproject.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index 5e334827f61..60726bf14f6 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -142,6 +143,18 @@ QmlProject::QmlProject(const Utils::FilePath &fileName) QTimer::singleShot(0, this, lambda); } + } else { + connect(this, &QmlProject::anyParsingFinished, this, [this](Target *target, bool success) { + if (target && success) { + const Utils::FilePath &folder = projectDirectory(); + const Utils::FilePaths &uiFiles = files([&](const ProjectExplorer::Node *node) { + return node->filePath().completeSuffix() == "ui.qml" + && node->filePath().parentDir() == folder; + }); + if (!uiFiles.isEmpty()) + Core::EditorManager::openEditor(uiFiles.first(), Utils::Id()); + } + }); } }