Translucent widgets on X11

When running an X11 compositing manager it's possible to have translucent widgets by using 32 bit visuals, also known as ARGB visuals. We don't use these visuals by default in Qt because we've seen some driver issues which cause buggy rendering and widgets containing garbage pixels when first being shown, as well as generic slow-downs in some cases. However, we're now adding conditional ARGB visuals to top-level widgets that are non-opaque, i.e. either have the Qt::WA_NoSystemBackground attribute set or have a transparent or semi-transparent background color specified in the palette. This means that the ARGB visuals will be opt-in instead of being forced onto every Qt application.

What this all means that in 4.5 you'll be able to have nice translucent Qt widgets on your Linux desktop without any hassle, as long as you have a compositing manager running (which should be easy to enable on newer distributions). Of course, this wouldn't be a proper graphics dojo post without a nice and shiny example, so I've cooked up an example which puts some nice chrome buttons inside a graphics view, and does a fancy animation when you click on the buttons. Here's a screenshot:

Translucent widget example

Translucent widget video capture

To play with the source and try the example out for yourself, do "svn checkout svn://". You'll have to wait for the snapshots to be back online to get the translucency effect though :)

Blog Topics: