Force the Material theme since our UI relies on it

This commit is contained in:
Cameron Gutman 2023-09-05 19:25:09 -05:00
parent 9ed40b5d9f
commit 2eee9c019f

View file

@ -635,29 +635,19 @@ int main(int argc, char *argv[])
// Create the identity manager on the main thread // Create the identity manager on the main thread
IdentityManager::get(); IdentityManager::get();
#ifndef Q_OS_WINRT // We require the Material theme
// Use the dense material dark theme by default QQuickStyle::setStyle("Material");
if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE")) {
qputenv("QT_QUICK_CONTROLS_STYLE", "Material"); // Our icons are styled for a dark theme, so we do not allow the user to override this
}
#else
// Use universal dark on WinRT
if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE")) {
qputenv("QT_QUICK_CONTROLS_STYLE", "Universal");
}
#endif
if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MATERIAL_THEME")) {
qputenv("QT_QUICK_CONTROLS_MATERIAL_THEME", "Dark"); qputenv("QT_QUICK_CONTROLS_MATERIAL_THEME", "Dark");
}
// These are defaults that we allow the user to override
if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MATERIAL_ACCENT")) { if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MATERIAL_ACCENT")) {
qputenv("QT_QUICK_CONTROLS_MATERIAL_ACCENT", "Purple"); qputenv("QT_QUICK_CONTROLS_MATERIAL_ACCENT", "Purple");
} }
if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MATERIAL_VARIANT")) { if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MATERIAL_VARIANT")) {
qputenv("QT_QUICK_CONTROLS_MATERIAL_VARIANT", "Dense"); qputenv("QT_QUICK_CONTROLS_MATERIAL_VARIANT", "Dense");
} }
if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_UNIVERSAL_THEME")) {
qputenv("QT_QUICK_CONTROLS_UNIVERSAL_THEME", "Dark");
}
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
QString initialView; QString initialView;