Skip to content

Fix initial window size calculations

Nate Graham requested to merge ngraham/kxmlgui:fix-initial-window-size into master

KMainWindow::applyMainWindowSettings() currently does resize(windowHandle()->size()); unconditionally, but that will always return 640x480. As a result, all KXMLGUI-using apps will get an initial main window size of 640x480, overriding whatever size hint they might have set. This yields an unpolished first impression to the new user due to windows being too small the first time apps are launched.

Various apps have been working around this by adding an initial resize() call to their main window code, which is not super desirable, as it amounts to clients working around a workaround in frameworks.

In order to avoid negative consequences from this workaround, we need to set the newly-created window to have the geometry of the existing widget, which ensures that its sizeHint is applied properly.

cc @dfaure @davidhurka

This can be tested by removing all width and height related values in the [MainWindow] section of ~/.config/okularrc and then launching Okular. The main window should be nice and big, not super tiny.

Edited by Nate Graham

Merge request reports