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 video capture
To play with the source and try the example out for yourself, do “svn checkout svn://labs.trolltech.com/svn/graphics/dojo/glossygradients”. You’ll have to wait for the snapshots to be back online to get the translucency effect though ![]()
9 Responses to “Translucent widgets on X11”
Nice! Just a note regarding the video. You should no longer use the “ogg” extension for video files, “ogv” is recommended for that now: http://wiki.xiph.org/MIME_Types_and_File_Extensions
EFL version at: http://blog.gustavobarbieri.com.br/2008/09/23/translucent-widgets-on-x11-efl-version/
Thanks for the idea ![]()
Really nice! Is something like that possible also on Macs, I mean nice non rectangular widgets. I tried with a mask, but it looks ugly like … the clock ![]()
It should work on Mac OS X, but we haven’t implemented it. I guess we were trying to keep the experience cross-platform. It really isn’t that difficult though, so we’ll see if we can’t get this fixed up shortly.
Very nice. I am anxious to see what is happening with respect to Animation. I was reading about Mamo’s use of Clutter, which is GTK’s animated desktop. There was a nice demo of it at http://arstechnica.com/news.ars/post/20080924-nokia-will-bring-bling-and-finger-friendliness-to-maemo-5.html.
I hope QT can match the animated user experience as shown in this GTK demo.
Any hope for this on Win32?
I like the example, however it doesn’t run very smoothly. After reading the QTimeLine docs though, this is simply because its default update interval is 40 ms, leading to just 25 frames per second. Inserting the following line after its construction makes the example run nice and smooth (50 fps, in theory):
m_rotation->setUpdateInterval(20);
Scorp1us: We’re planning to support this on Windows too, though I can’t say exactly when it will be implemented.
Bjørn: Thanks, I changed the example to include your suggestion. It certainly feels smoother now ![]()
Are you using VIM there?
Is it right?
Restecpa ![]()
