1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-31 00:07:39 +02:00

[launcher][android] force Qt window size to match available screen size

This commit is contained in:
Andrey Filipenkov
2024-06-08 20:54:58 +03:00
parent a33a37b1a4
commit 53048bde4f

View File

@@ -54,6 +54,17 @@ int MAIN_EXPORT main(int argc, char * argv[])
MainWindow mainWindow;
mainWindow.show();
#ifdef VCMI_ANDROID
// changing language causes window to increase size over the bounds, force it back to proper value
// TODO: check in Qt 6 if the hack is still needed
auto appWindow = vcmilauncher.focusWindow();
auto resizeWindowToScreen = [appWindow]{
appWindow->resize(appWindow->screen()->availableSize());
};
QObject::connect(appWindow, &QWindow::widthChanged, resizeWindowToScreen);
QObject::connect(appWindow, &QWindow::heightChanged, resizeWindowToScreen);
#endif
result = vcmilauncher.exec();
#ifdef VCMI_IOS
}