Skip to content

Commit dfededc

Browse files
committed
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.
1 parent 4dad447 commit dfededc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/launch/launch.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
7373
bool useQApplication = false;
7474
bool nativeTextRendering = false;
7575
bool desktopSettingsAware = true;
76+
bool useSystemStyle = false;
7677
QString iconTheme = qEnvironmentVariable("QS_ICON_THEME");
7778
QHash<QString, QString> envOverrides;
7879
QString dataDir;
@@ -88,6 +89,7 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
8889
if (pragma == "UseQApplication") pragmas.useQApplication = true;
8990
else if (pragma == "NativeTextRendering") pragmas.nativeTextRendering = true;
9091
else if (pragma == "IgnoreSystemSettings") pragmas.desktopSettingsAware = false;
92+
else if (pragma == "RespectSystemStyle") pragmas.useSystemStyle = true;
9193
else if (pragma.startsWith("IconTheme ")) pragmas.iconTheme = pragma.sliced(10);
9294
else if (pragma.startsWith("Env ")) {
9395
auto envPragma = pragma.sliced(4);
@@ -155,6 +157,11 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
155157

156158
Common::INITIAL_ENVIRONMENT = QProcessEnvironment::systemEnvironment();
157159

160+
if (!pragmas.useSystemStyle) {
161+
qunsetenv("QT_STYLE_OVERRIDE");
162+
qputenv("QT_QUICK_CONTROLS_STYLE", "Fusion");
163+
}
164+
158165
for (auto [var, val]: pragmas.envOverrides.asKeyValueRange()) {
159166
qputenv(var.toUtf8(), val.toUtf8());
160167
}

0 commit comments

Comments
 (0)