QmlDesigner: Add option to allow multiple projects

Setting QML/Designer/AllowMultipleProjects to true
allows multiple projects.

Task-number: QDS-7865
Change-Id: Ib44653e48cfbdb439c18dc2d3c57a4ae2ab0ee43
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Thomas Hartmann
2022-10-26 15:42:47 +02:00
parent ed0727e88f
commit 565bb8052f

View File

@@ -88,6 +88,14 @@ static int preferedQtTarget(Target *target)
return 5; return 5;
} }
static bool allowOnlySingleProject()
{
QSettings *settings = Core::ICore::settings();
const QString qdsAllowMultipleProjects = "QML/Designer/AllowMultipleProjects";
return !settings->value(qdsAllowMultipleProjects, false).toBool();
}
const char openInQDSAppSetting[] = "OpenInQDSApp"; const char openInQDSAppSetting[] = "OpenInQDSApp";
Utils::FilePaths QmlProject::getUiQmlFilesForFolder(const Utils::FilePath &folder) Utils::FilePaths QmlProject::getUiQmlFilesForFolder(const Utils::FilePath &folder)
@@ -110,9 +118,10 @@ QmlProject::QmlProject(const Utils::FilePath &fileName)
setBuildSystemCreator([](Target *t) { return new QmlBuildSystem(t); }); setBuildSystemCreator([](Target *t) { return new QmlBuildSystem(t); });
if (QmlProject::isQtDesignStudio()) { if (QmlProject::isQtDesignStudio()) {
if (allowOnlySingleProject()) {
EditorManager::closeAllDocuments(); EditorManager::closeAllDocuments();
SessionManager::closeAllProjects(); SessionManager::closeAllProjects();
}
m_openFileConnection m_openFileConnection
= connect(this, = connect(this,