Utils: Actually delete subwidgets on finish()

In the context of option pages, finish() means that the dialog is
dismissed somehow. Keeping the widgets around for subsequent re-use
is ok in principle, on the other hand it's a matter of hygiene and
give a defined clean slate next time addToLayout() is used.

This has not much practical impact yet as most option pages do not
forward finish() to their aspects right now.

Change-Id: Ifd591e3fa0d07c7943e86eb5474429efae2887f9
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2021-03-24 05:41:03 +01:00
parent b569258748
commit 641bccacf1
2 changed files with 9 additions and 1 deletions

View File

@@ -429,7 +429,8 @@ void BaseAspect::cancel()
void BaseAspect::finish() void BaseAspect::finish()
{ {
// FIXME: Delete widgets? qDeleteAll(d->m_subWidgets);
d->m_subWidgets.clear();
} }
bool BaseAspect::hasAction() const bool BaseAspect::hasAction() const
@@ -1448,6 +1449,12 @@ void SelectionAspect::setVolatileValue(const QVariant &val)
} }
} }
void SelectionAspect::finish()
{
BaseAspect::finish();
delete d->m_buttonGroup;
}
void SelectionAspect::setDisplayStyle(SelectionAspect::DisplayStyle style) void SelectionAspect::setDisplayStyle(SelectionAspect::DisplayStyle style)
{ {
d->m_displayStyle = style; d->m_displayStyle = style;

View File

@@ -245,6 +245,7 @@ public:
void addToLayout(LayoutBuilder &builder) override; void addToLayout(LayoutBuilder &builder) override;
QVariant volatileValue() const override; QVariant volatileValue() const override;
void setVolatileValue(const QVariant &val) override; void setVolatileValue(const QVariant &val) override;
void finish() override;
int value() const; int value() const;
void setValue(int val); void setValue(int val);