Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Enforce Fusion Qt style on Linux #6664

Merged
merged 1 commit into from
Jul 24, 2022

Conversation

tytan652
Copy link
Collaborator

Description

Found the issue on Linux, the Plasma default theme Breeze also provide a Qt style plugin.
This plugin add a frame to QDockWidget.
Those frames are not stylable with QSS because those are drawn with QPainter.

Flatpak install is always affected because the KDE Runtime provide Breeze, and Linux systems with Breeze installed are also affected for non-Flatpak install

So to avoid this the base style is enforce to the Qt default style on Linux: Fusion.

Screenshot made with #2778

Without the PR:
Thanks_Qt_and_Breeze

With the PR:
Thanks_Fusion

Motivation and Context

I want Yami to be nice on Linux and Qt doesn't want me to be happy.

How Has This Been Tested?

  • Run without the commit: frames around docks
  • Run with the commit: no frames around docks

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@gxalpha gxalpha added the Bug Fix Non-breaking change which fixes an issue label Jun 27, 2022
@gxalpha gxalpha added the Linux Affects Linux label Jun 27, 2022
@SuslikV
Copy link
Contributor

SuslikV commented Jun 27, 2022

Maybe stupid question... Will work the QApplication setStyle QStyleFactory create("Fusion") sequence for OBS only, but not for every Qt application installed in the system? I don't like the global env vars.

@tytan652
Copy link
Collaborator Author

tytan652 commented Jun 27, 2022

Maybe stupid question... Will work the QApplication setStyle QStyleFactory create("Fusion") sequence for OBS only, but not for every Qt application installed in the system? I don't like the global env vars.

This will try to apply Fusion over Breeze by "merging" them because the base style is already Breeze. To avoid Breeze to be used as base style this env var is unfortunately necessary.

Edit: The env var only apply to the application context, only OBS and everything that run inside OBS are affected. Not global.

Edit2: This way if the user really wants to he can override the enforce.

@WizardCM
Copy link
Member

While I overall agree with this change due on limitations in the Qt API, the only downside of this change is that for users who use the System theme, it may no longer look like their system if a custom style is applied automatically.

@tytan652
Copy link
Collaborator Author

tytan652 commented Jun 29, 2022

The System theme on Linux:

  • Will be Breeze (light) or Fusion in Flatpak, so this change is minor on Flatpak
  • Is expected to generate bizarre style and to not work really well with dark system theme (like OBS icons still black).

We could (OR):

  • Keep System and consider it as a Fusion style
  • Remove the System theme on Linux build
  • Rename it to Fusion on Linux

@jp9000
Copy link
Member

jp9000 commented Jun 29, 2022

If this affects KDE only, is there a way to only turn this on when KDE is active? Or do we need to have this on gnome as well?

@tytan652
Copy link
Collaborator Author

This issue is related to Breeze Qt style plugin which is DE-agnostic, it will affect:

  • every Flatpak installation because of the KDE Runtime.
  • every user that have Breeze installed and use it on their system as Qt default Style.

So the only way is to enforce Qt's default: Fusion. User can still override it if they want to on non-Flatpak install.

@jp9000
Copy link
Member

jp9000 commented Jun 30, 2022

Ah okay, I think I misunderstood originally then. Linux is definitely not my expertise.

@dimtpap
Copy link
Contributor

dimtpap commented Jul 3, 2022

This is how Yami looks for me without this PR
image
and then with this PR
image

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.
@WizardCM WizardCM merged commit 6d06052 into obsproject:master Jul 24, 2022
@RytoEX RytoEX added this to the OBS Studio 28.0 milestone Jul 24, 2022
@GloriousEggroll
Copy link
Contributor

GloriousEggroll commented Jul 26, 2022

This commit causes OBS to not follow Gnome's theming if breeze is installed, notice the title bar in the screenshots

Here is my setup:

I'm using GNOME
I have the breeze packages installed because Kdenlive needs them to display properly
I launch OBS with this commit -- my theme is in dark mode
Screenshot from 2022-07-25 22-13-59
mode but OBS's bar is bright white:

If I revert the commit, the title bar behaves:
Screenshot from 2022-07-25 22-25-13

$ rpm -qa | grep breeze
breeze-icon-theme-5.96.0-1.fc36.noarch
breeze-gtk-common-5.25.3-1.fc36.noarch
breeze-gtk-gtk3-5.25.3-1.fc36.noarch
breeze-gtk-gtk4-5.25.3-1.fc36.noarch
plasma-breeze-common-5.25.3-1.fc36.noarch
breeze-gtk-gtk2-5.25.3-1.fc36.noarch
plasma-breeze-5.25.3-1.fc36.x86_64

@tytan652
Copy link
Collaborator Author

tytan652 commented Jul 26, 2022

Breeze have nothing to do with that, you are actually defaulting to Qgnome platform the Qt Platform Theme made by Fedora IIRC which seems to manage the decoration bar theme.

Qt doesn't provide a way to avoid breeze (the Qt Style) if this is installed and will be used. The only solution to always avoid Breeze is to enforce Fusion.
I don't even know if other Qt Style "break" OBS themes.

The user still can set QT_STYLE_OVERRIDE and OBS will not override it. Feel free to used that at the price to potentially break OBS theme.

@tytan652 tytan652 deleted the i_cant_breeze branch July 31, 2022 14:30
@GloriousEggroll
Copy link
Contributor

thanks for the tip -- i resolved this by removing:
qgnomeplatform-qt5
qgnomeplatform-qt6
from my system after your tip

@tytan652
Copy link
Collaborator Author

tytan652 commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix Non-breaking change which fixes an issue Linux Affects Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants