From 34d577d74873168025c63736bf5783fe24ef6e85 Mon Sep 17 00:00:00 2001 From: tytan652 Date: Fri, 24 May 2024 10:35:18 +0200 Subject: [PATCH] UI: Enforce completely Fusion Qt style on Linux As of 8dcfae9a390763645d354700f36caef6b8f482c7, indicating the base style to the proxy is completely functional. It also bypasses QT_STYLE_OVERRIDE and -style, but since the system theme is no longer available on Linux this is a non-issue. --- UI/obs-app-theming.cpp | 4 ++++ UI/obs-app.cpp | 6 ------ UI/obs-proxy-style.hpp | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/UI/obs-app-theming.cpp b/UI/obs-app-theming.cpp index 22184ba9b..6571c9529 100644 --- a/UI/obs-app-theming.cpp +++ b/UI/obs-app-theming.cpp @@ -930,7 +930,11 @@ static map themeMigrations = { bool OBSApp::InitTheme() { defaultPalette = palette(); +#if !defined(_WIN32) && !defined(__APPLE__) + setStyle(new OBSProxyStyle("Fusion")); +#else setStyle(new OBSProxyStyle()); +#endif /* Set search paths for custom 'theme:' URI prefix */ string searchDir; diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index 7e9bac2b5..88ee9c66a 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -1987,12 +1987,6 @@ static int run_program(fstream &logFile, int argc, char *argv[]) #endif #if !defined(_WIN32) && !defined(__APPLE__) - /* NOTE: The Breeze Qt style plugin adds frame arround QDockWidget with - * QPainter which can not be modifed. To avoid this the base style is - * enforce to the Qt default style on Linux: Fusion. */ - - setenv("QT_STYLE_OVERRIDE", "Fusion", false); - /* 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. */ diff --git a/UI/obs-proxy-style.hpp b/UI/obs-proxy-style.hpp index 437ce1e27..325b2abd4 100644 --- a/UI/obs-proxy-style.hpp +++ b/UI/obs-proxy-style.hpp @@ -4,6 +4,10 @@ class OBSProxyStyle : public QProxyStyle { public: + OBSProxyStyle() : QProxyStyle() {} + + OBSProxyStyle(const QString &key) : QProxyStyle(key) {} + int styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const override;