From 4590a3c8f5ee7035f65dd75fafa3a7ccf5a1ef5f Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 12 Feb 2019 09:47:03 +0100 Subject: [PATCH] ProjectExplorer: Inline KitManager::createConfigWidget Instead of creating the widget first and polish it, create a polished widget directly. Change-Id: I665d26d6cbd87187f6d29ec3246a7db5c69d1a7f Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/kitmanager.cpp | 11 ----------- src/plugins/projectexplorer/kitmanager.h | 3 --- .../projectexplorer/kitmanagerconfigwidget.cpp | 5 +++++ src/plugins/projectexplorer/kitmodel.cpp | 2 +- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index e80e95bcede..051a641afbd 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -370,17 +370,6 @@ const QList KitManager::kitAspects() return Utils::toRawPointer(d->m_informationList); } -KitManagerConfigWidget *KitManager::createConfigWidget(Kit *k) -{ - auto *result = new KitManagerConfigWidget(k); - for (KitAspect *aspect : kitAspects()) - result->addAspectToWorkingCopy(aspect); - - result->updateVisibility(); - - return result; -} - void KitManager::notifyAboutUpdate(Kit *k) { if (!k || !isLoaded()) diff --git a/src/plugins/projectexplorer/kitmanager.h b/src/plugins/projectexplorer/kitmanager.h index bbe96813c7c..439a392ec47 100644 --- a/src/plugins/projectexplorer/kitmanager.h +++ b/src/plugins/projectexplorer/kitmanager.h @@ -54,7 +54,6 @@ class KitAspectWidget; class KitManager; namespace Internal { -class KitManagerConfigWidget; class KitModel; } // namespace Internal @@ -170,8 +169,6 @@ public: static const QList kitAspects(); - static Internal::KitManagerConfigWidget *createConfigWidget(Kit *k); - static bool registerKit(std::unique_ptr &&k); static void deregisterKit(Kit *k); static void setDefaultKit(Kit *k); diff --git a/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp b/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp index 20c006bc21d..6dad16eeae9 100644 --- a/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp +++ b/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp @@ -121,6 +121,11 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k) : auto chooser = new Core::VariableChooser(this); chooser->addSupportedWidget(m_nameEdit); chooser->addMacroExpanderProvider([this]() { return m_modifiedKit->macroExpander(); }); + + for (KitAspect *aspect : KitManager::kitAspects()) + addAspectToWorkingCopy(aspect); + + updateVisibility(); } KitManagerConfigWidget::~KitManagerConfigWidget() diff --git a/src/plugins/projectexplorer/kitmodel.cpp b/src/plugins/projectexplorer/kitmodel.cpp index dbc04d559fa..80e613fbf5a 100644 --- a/src/plugins/projectexplorer/kitmodel.cpp +++ b/src/plugins/projectexplorer/kitmodel.cpp @@ -46,7 +46,7 @@ class KitNode : public TreeItem public: KitNode(Kit *k) { - widget = KitManager::createConfigWidget(k); + widget = new KitManagerConfigWidget(k); if (widget) { if (k && k->isAutoDetected()) widget->makeStickySubWidgetsReadOnly();