applyMainWindowSettings bug?

Vladimir Prus ghost at
Thu May 1 13:26:59 BST 2008

I observe behaviour where applyMainWindowSettings does not appear
to work. I attach a simple program that can reproduce this behavior,
as follows:

1. Compile.
2. Run.
3. Maximize the window
4. Exit
5. Look at ~/.kde4/share/config/example3rc, and note that the saved
size is 1 bigger that screen dimensions -- which is used to indicate
6. Run application again. Expected result is the the window be maximized.
Actual result is that the window is 200x200.

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". Is this possible in any way?

For the record, this testcase is a much reduced version of a issue KDevelop4
run into; it's probably possible to work it around, but this bug is fairly
nasty and hard-to-debug, so ideally it should be fixed in KMainWindow.


More information about the kde-core-devel mailing list