diff options
author | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2021-12-09 01:21:06 +0100 |
---|---|---|
committer | Nadia Holmquist Pedersen <nadia@nhp.sh> | 2021-12-09 01:21:06 +0100 |
commit | 14c6bba21f7f018035ad017c8a6d771a94243d18 (patch) | |
tree | 171b211eb336d21315eb2dc3b1f556c4336d3e31 /src | |
parent | 151610eb6c0ec89e3947f0d85796e27c5868903e (diff) |
Manually center the window after setting its size on macOS
Qt's default window positioning is somewhat unreliable, and since we
don't currently remember the window position, let's at least make sure
that it's properly centered on open.
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/qt_sdl/main.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 0447cbb..332e3e1 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -1566,6 +1566,13 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) resize(Config::WindowWidth, Config::WindowHeight); +#ifdef Q_OS_MAC + QPoint screenCenter = screen()->availableGeometry().center(); + QRect frameGeo = frameGeometry(); + frameGeo.moveCenter(screenCenter); + move(frameGeo.topLeft()); +#endif + if (oldMax) showMaximized(); else |