aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-04-29 15:45:27 +0200
committerEike Ziller <eike.ziller@qt.io>2019-05-08 05:44:40 +0000
commitcf5232b27a13573d061d24ec5ef4b3d6af6c512b (patch)
tree9720c317a60b5e05a695613757afe2379495234b
parent2330103ababa71a2cceff1cdd11176636cb5ed29 (diff)
Fix passing of kit IDs for subproject to JSON wizards
The list of preselected kits in case of sub projects was passed in a format not compatible with wizard variables (QList<Id>, but only QString and QStringList are supported). This fixes the visibility of the Kit selection page of the "Empty qmake Project" and "Auto Test Project" wizards when triggered from "Add New Subproject" from the project tree's context menu. Change-Id: Ica7305825d6323697c9b0788a9634f3d806b9d50 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp13
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp37
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp3
3 files changed, 34 insertions, 19 deletions
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 160b0cb65e..3d619eab82 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -3327,8 +3327,10 @@ void ProjectExplorerPluginPrivate::addNewFile()
map.insert(QLatin1String(Constants::PREFERRED_PROJECT_NODE), QVariant::fromValue(static_cast<void *>(currentNode)));
map.insert(Constants::PREFERRED_PROJECT_NODE_PATH, currentNode->filePath().toString());
if (Project *p = ProjectTree::currentProject()) {
- QList<Id> profileIds = Utils::transform(p->targets(), &Target::id);
- map.insert(QLatin1String(Constants::PROJECT_KIT_IDS), QVariant::fromValue(profileIds));
+ const QStringList profileIds = Utils::transform(p->targets(), [](const Target *t) {
+ return t->id().toString();
+ });
+ map.insert(QLatin1String(Constants::PROJECT_KIT_IDS), profileIds);
map.insert(Constants::PROJECT_POINTER, QVariant::fromValue(static_cast<void *>(p)));
}
ICore::showNewItemDialog(ProjectExplorerPlugin::tr("New File", "Title of dialog"),
@@ -3352,8 +3354,11 @@ void ProjectExplorerPluginPrivate::addNewSubproject()
Project *project = ProjectTree::currentProject();
Core::Id projectType;
if (project) {
- QList<Id> profileIds = Utils::transform(ProjectTree::currentProject()->targets(), &Target::id);
- map.insert(QLatin1String(Constants::PROJECT_KIT_IDS), QVariant::fromValue(profileIds));
+ const QStringList profileIds = Utils::transform(ProjectTree::currentProject()->targets(),
+ [](const Target *t) {
+ return t->id().toString();
+ });
+ map.insert(QLatin1String(Constants::PROJECT_KIT_IDS), profileIds);
projectType = project->id();
}
diff --git a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp
index 9ed1939f1a..9a4b97a0b7 100644
--- a/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/qtwizard.cpp
@@ -140,25 +140,34 @@ bool CustomQmakeProjectWizard::postGenerateFiles(const QWizard *w, const Core::G
}
// ----------------- BaseQmakeProjectWizardDialog
-BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
- bool showModulesPage, QWidget *parent,
- const Core::WizardDialogParameters &parameters) :
- ProjectExplorer::BaseProjectWizardDialog(factory, parent, parameters),
- m_profileIds(parameters.extraValues().value(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))
- .value<QList<Core::Id> >())
+BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(
+ const Core::BaseFileWizardFactory *factory,
+ bool showModulesPage,
+ QWidget *parent,
+ const Core::WizardDialogParameters &parameters)
+ : ProjectExplorer::BaseProjectWizardDialog(factory, parent, parameters)
{
+ m_profileIds = Utils::transform(parameters.extraValues()
+ .value(ProjectExplorer::Constants::PROJECT_KIT_IDS)
+ .toStringList(),
+ &Core::Id::fromString);
+
init(showModulesPage);
}
-BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
- bool showModulesPage,
- Utils::ProjectIntroPage *introPage,
- int introId, QWidget *parent,
- const Core::WizardDialogParameters &parameters) :
- ProjectExplorer::BaseProjectWizardDialog(factory, introPage, introId, parent, parameters),
- m_profileIds(parameters.extraValues().value(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))
- .value<QList<Core::Id> >())
+BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(
+ const Core::BaseFileWizardFactory *factory,
+ bool showModulesPage,
+ Utils::ProjectIntroPage *introPage,
+ int introId,
+ QWidget *parent,
+ const Core::WizardDialogParameters &parameters)
+ : ProjectExplorer::BaseProjectWizardDialog(factory, introPage, introId, parent, parameters)
{
+ m_profileIds = Utils::transform(parameters.extraValues()
+ .value(ProjectExplorer::Constants::PROJECT_KIT_IDS)
+ .toStringList(),
+ &Core::Id::fromString);
init(showModulesPage);
}
diff --git a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp
index 306a2438a4..7c2f57420a 100644
--- a/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/subdirsprojectwizard.cpp
@@ -89,7 +89,8 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener
const QString profileName = Core::BaseFileWizardFactory::buildFileName(projectPath, params.fileName, profileSuffix());
QVariantMap map;
map.insert(QLatin1String(ProjectExplorer::Constants::PREFERRED_PROJECT_NODE), profileName);
- map.insert(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS), QVariant::fromValue(wizard->selectedKits()));
+ map.insert(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS),
+ Utils::transform<QStringList>(wizard->selectedKits(), &Core::Id::toString));
IWizardFactory::requestNewItemDialog(tr("New Subproject", "Title of dialog"),
Utils::filtered(Core::IWizardFactory::allWizardFactories(),
[](Core::IWizardFactory *f) {