Explorar el Código

Merge pull request #4114 from kambala-decapitator/android-launcher-window-size

[launcher][android] force Qt window size to match available screen size
Ivan Savenko hace 1 año
padre
commit
a8af1287ce
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  1. 11 0
      launcher/main.cpp

+ 11 - 0
launcher/main.cpp

@@ -54,6 +54,17 @@ int MAIN_EXPORT main(int argc, char * argv[])
 	MainWindow mainWindow;
 	MainWindow mainWindow;
 	mainWindow.show();
 	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();
 	result = vcmilauncher.exec();
 #ifdef VCMI_IOS
 #ifdef VCMI_IOS
 	}
 	}