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 <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2023-08-25 11:15:02 +02:00
parent b237cd5e25
commit 1a43983ea6

View File

@@ -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<QWidget *> m_labels;
QList<KitAspectWidget *> m_widgets;
};