forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -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 ¶meters) :
|
||||
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 ¶meters)
|
||||
: 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 ¶meters) :
|
||||
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 ¶meters)
|
||||
: 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);
|
||||
}
|
||||
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user