sroedal
KDE
Graphics Dojo
Posted by sroedal
 in KDE, Graphics Dojo
 on Tuesday, September 23, 2008 @ 18:41

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://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”

» Posted by Robin
 on Tuesday, September 23, 2008 @ 19:06

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

 on Tuesday, September 23, 2008 @ 20:38
» Posted by Andrea
 on Tuesday, September 23, 2008 @ 23:40

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 :-)

» Posted by trenton
 on Wednesday, September 24, 2008 @ 08:43

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.

» Posted by David B
 on Wednesday, September 24, 2008 @ 14:08

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.

» Posted by Scorp1us
 on Wednesday, September 24, 2008 @ 18:25

Any hope for this on Win32?

» Posted by Bjørn Lindeijer
 on Thursday, September 25, 2008 @ 12:11

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);

» Reply from sroedal
 on Thursday, September 25, 2008 @ 16:29
sroedal

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 :)

» Posted by pettersolberg
 on Friday, September 26, 2008 @ 09:42

Are you using VIM there?
Is it right?
Restecpa :)



© 2008 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners.