Bug 207216

Summary: Oxygen style mishandles background transparency
Product: [Plasma] Oxygen Reporter: Steven M. Parrish <smparrish>
Component: styleAssignee: Camilla Boemann <cbo>
Status: RESOLVED FIXED    
Severity: normal CC: hugo.pereira.da.costa, rdieter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Sample code to show the bug
Screenshot of the incorrectly rendered result
Fixed background rendering when base color has alpha channel

Description Steven M. Parrish 2009-09-13 00:48:54 UTC
Version:            (using KDE 4.3.1)
OS:                Linux
Installed from:    Fedora RPMs

Description of problem:
When the Oxygen style is being used, transparent backgrounds for widgets are
not handled correctly. Undesirable artefacts are shown and transparency is not
always enforced. Sample code is attached and I'll also attach a screen shot
shortly. Using any other style works as expected, so the problem seems to be
restricted to the Oxygen style. I have had correspondence with Nokia on this
issue and we agree that the Oxygen style appears to be the cause.

Version-Release number of selected component (if applicable):
The bug only shows up for Qt4.4.1 and later. When using Qt4.4.0 the bug does
not seem to show up.

How reproducible:
See attached code sample and screen shot.

Actual/expected results:
The sample code should show a light green box with QLabel text drawn over it.
The bug instead causes a dark green box to be drawn partly over the light green
box and the label never appears. Other manifestations of the bug show a black
box instead, but the general behavior seems to be that a darker box seems to
cover approximately the upper half of the widget and transparency is
mishandled.
Comment 1 Craig Scott 2009-09-13 07:54:11 UTC
Created attachment 36913 [details]
Sample code to show the bug
Comment 2 Craig Scott 2009-09-13 07:54:42 UTC
Created attachment 36914 [details]
Screenshot of the incorrectly rendered result
Comment 3 Hugo Pereira Da Costa 2009-10-18 20:07:02 UTC
There are two issues here:
1/ the gradient, if shown, is not rendered properly. I believe this is because the alpha channel of the widget background color is not properly accounted for when calculating the gradients. This can probably be fixed for kde4.4

2/ there should not be any gradient here anyway. This one might be a Qt bug. The thing is that your widget is assigned a Qt::Window flag (which triggers the gradient painting) (Note: thanks Casper for the clue where to look), because it has no parent, even if it gets embedded into a graphicsScene. This is a Qt decision/bug/feature (I don't know). We can either 
- file a Qt bug
- try make the triggering of background gradient rendering more strict to detect cases above (but that might then break other things)
- let you add a parent to your widget :-)
Comments welcome.

Let me try fix 1/ first ...
Comment 4 Hugo Pereira Da Costa 2009-10-18 21:50:24 UTC
ok. So item 1/ above is fixed (see attachment). 
For Item 2/ I'm not sure how to address.
Comment 5 Hugo Pereira Da Costa 2009-10-18 21:52:17 UTC
Created attachment 37653 [details]
Fixed background rendering when base color has alpha channel