[PATCH] Avoid double margins in KDialog
aurelien.gateau at free.fr
Wed Dec 5 08:44:36 GMT 2007
Aaron J. Seigo <aseigo <at> kde.org> writes:
> On Tuesday 04 December 2007, Aurélien Gâteau wrote:
> > Attached patch implements this. Is it ok to commit (after tag freeze that
> > is)?
> yes, please! this is such a common error, catching it in KDialog makes all
> sense in the world. it also makes it easier to create reusable layouts (e.g.
> both in a dialog and in another layout) ..
Ok, will do. Unfortunately it won't fix all dialogs. I have been running with
the patch yesterday and noticed some dialogs still had double margins. Looking
a the code, I discover they create their dialog content this way:
The trick here is that if there is no main widget set, mainWidget() will
create one and set it before returning. So mainWidget() calls setMainWidget(),
and at the time of the call, the newly created widget does not have any layout
I personnally find it strange to have an accessor creating a widget instead of
returning a null pointer, even if I can see how it can be convenient.
Unfortunately it's probably too late to fix this. Or is it not?
Anyway, I will probably start a crusade against double margins before 4.0 is
out. It's easy to join the crusade: just have a look at your prefered app
dialogs and add a few setMargin(0) where necessary.
More information about the kde-core-devel