[Konsole-devel] Review Request: Make Konsole translucent using Qt 4.5's top-level transparency

Eike Hein hein at kde.org
Mon Mar 23 15:45:05 UTC 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/394/#review566
-----------------------------------------------------------


Quoting Harald's response, which he send by email to me:

> hmmm... Only colors with alpha values should be affected by the flag? On Mac OS 
> X, the tab bar is solid, just the background (which has an alpha value set) is 
> semi-transparent.

Not quite. As written in the docs, WA_TranslucentBackground also implies WA_NoSystemBackground, which means that when the widget receives paint events, the widget background isn't automatically filled in. That means that when you set WA_TranslucentBackground on a top-level QWidget (i.e. a main window), it ends up being translucent. Now, child widgets like the menu bar or the tab bar don't paint their own backgrounds either, but inherit their backgrounds from the parent widget by default. This parent happens to be the main window here, so those widgets end up being transparent.

The reason this doesn't happen on OS X is probably because the OS X QStyle end up calling OS X system APIs to draw widget backgrounds and thus things like tab bars generally paint their own background there, which is not the case for most X11 QStyles such as KDE's Oxygen.

The terminal widget differs from the menu bar and the tab bar in that it always fills in all of its background itself.

Now, a fix would be adding setAutoFillBackground(true) on the menu bar and the tab bar, so that Qt fills in the backgrounds of these widgets instead of relying on background inheritance from the parent widget. The problem is that if I remember correctly, AutoFillBackground just solid-fills in the widget rectangle with the QPalette::Window color role. But in Oxygen, the default window background is actually a soft gradient, not a solid fill, so Konsole would look different to other apps then.

- Eike


On 2009-03-22 10:20:51, Harald Fernengel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/394/
> -----------------------------------------------------------
> 
> (Updated 2009-03-22 10:20:51)
> 
> 
> Review request for Konsole.
> 
> 
> Summary
> -------
> 
> This patch sets the Qt:WA_TranslucentBackground window attribute on the main window, allowing Konsole to be translucent using Qt's top-level transparency. Suddenly, Konsole is transparent on my Mac OS X :)
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdebase/apps/konsole/src/Application.cpp 888066 
> 
> Diff: http://reviewboard.kde.org/r/394/diff
> 
> 
> Testing
> -------
> 
> Mac OS X 10.5
> 
> 
> Thanks,
> 
> Harald
> 
>




More information about the konsole-devel mailing list