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.
This commit is contained in:
Nadia Holmquist Pedersen 2021-12-09 01:21:06 +01:00
parent 151610eb6c
commit 14c6bba21f

View File

@ -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