From dfededc901d4d103d5e238724a871965c6fe3b56 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Fri, 25 Jul 2025 18:24:43 -0700 Subject: [PATCH] launch: ignore QT_STYLE_OVERRIDE and QT_QUICK_CONTROLS_STYLE QT_STYLE_OVERRIDE often results in unexpected QML dependencies that don't exist being required. QT_QUICK_CONTROLS_STYLE can vary across systems and produce unexpected results. --- src/launch/launch.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/launch/launch.cpp b/src/launch/launch.cpp index 91e2e246..fd6a0af7 100644 --- a/src/launch/launch.cpp +++ b/src/launch/launch.cpp @@ -73,6 +73,7 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio bool useQApplication = false; bool nativeTextRendering = false; bool desktopSettingsAware = true; + bool useSystemStyle = false; QString iconTheme = qEnvironmentVariable("QS_ICON_THEME"); QHash envOverrides; QString dataDir; @@ -88,6 +89,7 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio if (pragma == "UseQApplication") pragmas.useQApplication = true; else if (pragma == "NativeTextRendering") pragmas.nativeTextRendering = true; else if (pragma == "IgnoreSystemSettings") pragmas.desktopSettingsAware = false; + else if (pragma == "RespectSystemStyle") pragmas.useSystemStyle = true; else if (pragma.startsWith("IconTheme ")) pragmas.iconTheme = pragma.sliced(10); else if (pragma.startsWith("Env ")) { auto envPragma = pragma.sliced(4); @@ -155,6 +157,11 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio Common::INITIAL_ENVIRONMENT = QProcessEnvironment::systemEnvironment(); + if (!pragmas.useSystemStyle) { + qunsetenv("QT_STYLE_OVERRIDE"); + qputenv("QT_QUICK_CONTROLS_STYLE", "Fusion"); + } + for (auto [var, val]: pragmas.envOverrides.asKeyValueRange()) { qputenv(var.toUtf8(), val.toUtf8()); }