Bug 354627 - The Breeze theme does not obey the background colour on QPushButton widgets that Qt applications set using style sheets.
Summary: The Breeze theme does not obey the background colour on QPushButton widgets t...
Status: REPORTED
Alias: None
Product: Breeze
Classification: Plasma
Component: QStyle (show other bugs)
Version: 5.4.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Hugo Pereira Da Costa
URL: http://imgur.com/a/X5hSK
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-31 02:13 UTC by Jasen Borisov
Modified: 2019-02-22 19:27 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jasen Borisov 2015-10-31 02:13:30 UTC
I am developing a Qt application (no KDE libraries, just bare Qt), which relies on setting the colour of a QPushButton to indicate the "current colour" set by the user (and open a colour dialogue window to change it when the user presses the button).

Quoting from the Qt documentation (http://doc.qt.io/qt-5.5/stylesheet.html):
"Unlike palette fiddling, style sheets offer guarantees: If you set the background color of a QPushButton to be red, you can be assured that the button will have a red background in all styles, on all platforms."

I am following this advice from the Qt documentation, and setting the style sheet of my QPushButton to set the background colour to whatever my application wants to display (full green (#00ff00) by default).

However, the KDE Breeze theme does not seem to obey this; hence I believe that this is a bug, as it works contrary to what the Qt documentation describes.

The Breeze theme overrides the colour of my button when the application's window is focused: the button is always displayed blue, regardless of what I set the style sheet value to. When the application's window is not focused, the button's colour is correct. Every other theme I tried (Oxygen, Fusion, MSWin95, GTK) works correctly: the button is always the correct colour, regardless of the window focus.

My application's GUI is not usable with KDE's Breeze theme as a result of this.

My application is just a prototype/experiment, and I have not published the source code anywhere, but I have provided screenshots to illustrate the problem. I do not believe providing the code is needed, as what I am doing is fairly standard (I am just following the Qt documentation), and the problem seems to be generic and not caused by faults in my code.


Reproducible: Always
Comment 1 Hugo Pereira Da Costa 2015-11-07 16:56:35 UTC
So. Breeze does honor the style sheet, except for focused buttons (and mouse-over), because, unlike other themes, we render focus (and mouse-hover) by painting the full button with the said color (whereas some sort of outline is used in other themes). 

In principle, the style sheet could also re-define the "highlight" color, (which in turn would be honored), except that ... we do not use the highlight color from Qt palette, but Focus and Hover colors from KDE's palette. And these, as far as I know, cannot be set in a stylesheet. 

The other possibility that I can think of, is to blend the focus with the background ...
In any case, i'll investigate some more ...
Comment 2 wolthera 2019-02-22 19:27:56 UTC
I came across this bug too... Might it be an idea that instead of using the 'hover' and 'focus' colors, you just refer to the highlight color instead? These are virtually the same for all three breeze colorschemes, so I am a little confused why it is necessary beyond semantics?