applyMainWindowSettings bug?

Lubos Lunak l.lunak at
Fri May 2 15:47:59 BST 2008

On Thursday 01 of May 2008, Vladimir Prus wrote:
> 6. Run application again. Expected result is the the window be maximized.
> Actual result is that the window is 200x200. . Qt bug.

> I think what happens is.
> 1. KMainWindow::restoreWindowSize, when handling the maximized window,
> does not call resize(). Instead, it asks the window manager to resize
> the window.
> 2. QWidget::setMinimumSize does:
>      resize(qMax(minw,width()), qMax(minh,height()));
> since the size is not yet changed at this point, we explicitly set the
> size to whatever the size the widget already has.
> It seems that the only right solution would be to wait for the window
> manager to actually resize the window to whatever size corresponds to
> "maximized".

 No. If  memory serves me well, that's actually what happens and what is 
causing the problem. The resizing in your step 2. actually happens _after_ 
the window is shown and maximized by the window manager, because of Qt's 
delayed layout activation (or whatever it is exactly that triggers it so 
late). So the window is first maximized by the window manager and then the 
application immediatelly asks to be resized again (and width()/height() still 
return old size because of X being asynchronous).

Lubos Lunak
KDE developer
SUSE LINUX, s.r.o.   e-mail: l.lunak at , l.lunak at
Lihovarska 1060/12   tel: +420 284 028 972
190 00 Prague 9      fax: +420 284 028 951
Czech Republic

More information about the kde-core-devel mailing list