summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
index 425cfcd552..5439d98d2b 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp
@@ -521,6 +521,19 @@ void JsonWizardFactory::registerGeneratorFactory(JsonWizardGeneratorFactory *fac
s_generatorFactories.append(factory);
}
+static QString qmlProjectName(const FilePath &folder)
+{
+ FilePath currentFolder = folder;
+ while (!currentFolder.isEmpty()) {
+ const QList<FilePath> fileList = currentFolder.dirEntries({"*.qmlproject"});
+ if (!fileList.isEmpty())
+ return fileList.first().baseName();
+ currentFolder = currentFolder.parentDir();
+ }
+
+ return {};
+}
+
Wizard *JsonWizardFactory::runWizardImpl(const FilePath &path, QWidget *parent,
Id platform,
const QVariantMap &variables, bool showWizard)
@@ -545,6 +558,7 @@ Wizard *JsonWizardFactory::runWizardImpl(const FilePath &path, QWidget *parent,
wizard->setValue(i.key(), i.value());
wizard->setValue(QStringLiteral("InitialPath"), path.toString());
+ wizard->setValue(QStringLiteral("QmlProjectName"), qmlProjectName(path));
wizard->setValue(QStringLiteral("Platform"), platform.toString());
QString kindStr = QLatin1String(Core::Constants::WIZARD_KIND_UNKNOWN);