1
0
Эх сурвалжийг харах

UI: Disable qt5ct when compiled with qt6

Qt is not smart enough to disable qt5 platform plugins when users
blindly ask for them, which causes users to be unable to start OBS.
Instead lets kindly disable broken platforms on their behalf.
Kurt Kartaltepe 2 жил өмнө
parent
commit
124ebedbdb
1 өөрчлөгдсөн 9 нэмэгдсэн , 0 устгасан
  1. 9 0
      UI/obs-app.cpp

+ 9 - 0
UI/obs-app.cpp

@@ -2302,6 +2302,15 @@ static int run_program(fstream &logFile, int argc, char *argv[])
 
 	setenv("QT_STYLE_OVERRIDE", "Fusion", false);
 
+#if OBS_QT_VERSION == 6
+	/* NOTE: Users blindly set this, but this theme is incompatble with Qt6 and
+	 * crashes loading saved geometry. Just turn off this theme and let users complain OBS
+	 * looks ugly instead of crashing. */
+	const char *platform_theme = getenv("QT_QPA_PLATFORMTHEME");
+	if (platform_theme && strcmp(platform_theme, "qt5ct") == 0)
+		unsetenv("QT_QPA_PLATFORMTHEME");
+#endif
+
 #if defined(ENABLE_WAYLAND) && defined(USE_XDG)
 	/* NOTE: Qt doesn't use the Wayland platform on GNOME, so we have to
 	 * force it using the QT_QPA_PLATFORM env var. It's still possible to