Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.4.0
-
None
-
Windows
-
0b62cd8da7d8ee078b799b95088a63626099caa4 (qtbase/5.4, 21.1.2015, 5.4.2?)
Description
Problem can be seen with the attached example which prints the result of this function on the console.
If you move the dialog to the top left corner of the usable space, the x coordinate is about 0. After maximizing, it is (on my computer) something like 92.
A practical consequence of this is that restoreGeometry() doesn't work reliably. If use use saveGeometry and restoreGeometry() in order to restore the old geometry, the restored position is wrong with the following steps:
- Start your application non-maximized
- Move the window to a certain position (e. g. upper left corner)
- Maximize it
- Exit
- Start (=> will correctly show the window maximized)
- Unmaximize (=> position will be outside of the desktop)
I suspect the use of GetWindowPlacement() in qwindowswindow.cpp to be guilty here. This works differently from other APIs (like GetWindowRect) in that the rectangle in WINDOWPLACEMENT is in the workspace, not in the screen coordinate system. There are three usages of this function and one usage of SetWindowPlacement; I haven't checked if other Qt functions are affected.
See e. g.: