From 1a43983ea63cd675c1ecfbd673618b391c5a03bb Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 25 Aug 2023 11:15:02 +0200 Subject: [PATCH] Fix that target selector accumulated labels for kit aspects. The widgets added to the "KitArea", including the created labels for the kit aspects, are children of the widget itself, not the layout, so since we do not delete the KitArea widget, we need to explicitly delete the labels too when updating, the same as we do for the aspects' widgets. Fixes: QTCREATORBUG-29519 Change-Id: I605edd4969345d18064c1c00ec4d617499de8eb7 Reviewed-by: Christian Kandeler Reviewed-by: hjk --- src/plugins/projectexplorer/miniprojecttargetselector.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index 3a1b01b724b..9ad218548bc 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -584,6 +584,8 @@ public: void setKit(Kit *k) { + qDeleteAll(m_labels); + m_labels.clear(); qDeleteAll(m_widgets); m_widgets.clear(); @@ -596,8 +598,10 @@ public: for (KitAspect *aspect : KitManager::kitAspects()) { if (k && k->isMutable(aspect->id())) { KitAspectWidget *widget = aspect->createConfigWidget(k); + auto label = new QLabel(aspect->displayName()); + m_labels << label; m_widgets << widget; - grid.addItems({aspect->displayName(), widget, Layouting::br}); + grid.addItems({label, widget, Layouting::br}); } } grid.attachTo(this); @@ -638,6 +642,7 @@ private: } Kit *m_kit = nullptr; + QList m_labels; QList m_widgets; };