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 <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-02-12 09:47:03 +01:00
parent 20798dfb57
commit 4590a3c8f5
4 changed files with 6 additions and 15 deletions

View File

@@ -370,17 +370,6 @@ const QList<KitAspect *> KitManager::kitAspects()
return Utils::toRawPointer<QList>(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())

View File

@@ -54,7 +54,6 @@ class KitAspectWidget;
class KitManager;
namespace Internal {
class KitManagerConfigWidget;
class KitModel;
} // namespace Internal
@@ -170,8 +169,6 @@ public:
static const QList<KitAspect *> kitAspects();
static Internal::KitManagerConfigWidget *createConfigWidget(Kit *k);
static bool registerKit(std::unique_ptr<Kit> &&k);
static void deregisterKit(Kit *k);
static void setDefaultKit(Kit *k);

View File

@@ -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()

View File

@@ -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();