[Differential] [Commented On] D4413: Template file dialog: kill old widgets on re-entering TemplateOptionsPage
Friedrich W. H. Kossebau
noreply at phabricator.kde.org
Mon Feb 6 17:18:56 UTC 2017
kossebau added a comment.
In https://phabricator.kde.org/D4413#82710, @mwolff wrote:
> this is really dirty. can you please change the code to only add stuff to a "known" widget and then delete that widget and its children here?
Hm, would that be less dirty? Any solution is fragile as they all require that any created QWidget does not get the page itself set as parent widget, otherwise it would be missed out in any cleanup.
I initially did a separate list of any created widgets, though explicit and not as proposed here, implicit by adding another dummy QWidget,. But then I realized that all the information is there in the existing data structure and just needs to be queried when needed. Which is what the loop did here.
delete m_containerWidget;
m_containerWidget = new QWidget(this);
layout()->addWidget(m_containerWidget);
would be what you prefer here?
On debugging UI structures I personall dislike any unneeded extra QWidget, Thus proposing the explicit collection of the groupbox widgets then, as compromise. Though I still think that initially proposed loop is good and just looks dirty because it had so many explanations ;)
REPOSITORY
R33 KDevPlatform
REVISION DETAIL
https://phabricator.kde.org/D4413
EMAIL PREFERENCES
https://phabricator.kde.org/settings/panel/emailpreferences/
To: kossebau, mwolff, #kdevelop
Cc: mwolff, kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170206/03b7bb0f/attachment.html>
More information about the KDevelop-devel
mailing list