Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.4, 6.2.4
-
None
Description
If the initial show() is called before setWindowState(Qt::WindowMaximized) in the constructor of a window sub-classed from QMainWindow, the window's layout and it's children do not get the correct maximized geometry and they appear in a small box in the corner with the following sequence of events
- run the attached program. It will open a window in the maximized state.
- User action causes QMainWindow::hide() to be called. (Hide button is clicked in this example)
- Some time later (2s timer started by the hide in this example) QMainWindow::show() is called and the window is restored but the children do not get the correct geometry.
If setWindowState(Qt::WindowMaximized) is called before the initial show() in the constructor, this issue does not happen. Included in the example code is a #ifdef to switch the order of these api, enabling and disabling the issue.
This only happens on windows. I have tested MacOS 12.3 + Qt6.3.1 and KDE Debian 11 + Qt5.15.2 and the children of the QMainWindow always fill the entire maximized window. I have confirmed the issue happens on Windows 10 + Qt5.15.4 and Window 11 + Qt6.2.4