Subnavigation

Passion and Plastique2

There's a lot of stuff going on in Development at Trolltech these days. So much that it's really hard to keep your Importants and Urgents in order, trying hard not to lapse into brain hypothema(? all google hits for that word seem to be in Dutch), but at the same time we're having so much fun with making Qt 4 better and better, that it's hard to keep your hands off the keyboard! ;-) Whether it's profiling and optimizing, creating new classes or polishing existing ones, there's enough by far to keep any developer busy. And btw, we need more developers (and developesses, please!), so hint-hint, if you're looking for a job... :-)

Wait up, wait up, back to the I's and U's. What's Important is of course fixing critical bugs like crashes, serious usability issues and regressions. What's Urgent is basically what has got to happen before some magic milestone X, like making stuff compile on Windows with MSVC .NET 2003 before we release 4.1.1. So you have to do your Important and Urgent stuff first. But then, there's what you are passionate about. You know the feeling. When there's something you just have to do, because it makes you feel great! And you typically get that feeling at 03:00am or when you just entered a 11-hour plane ride with no laptop around.

Anyway, today, passion has driven me to do more work on Plastique2. So Plastique is the default style on KDE for Qt apps that don't know better, but it doesn't quite deal with propagated backgrounds, like texture backgrounds and bases of a line edit. But now, with Plastique2, things are looking a whole lot better. Note that this is a jpeg, click on it to get the uncompressed png instead.

So what I've done is I've ditched the idea of "faking" alpha transparency, and gone the whole way through. So once finished, this will be the first true alpha blended Qt style, unless someone makes one before I'm done, of course. Some important points to notice here are:

  • The button contrast is improved, and the frame border color is now correct for all palette variants (no more black-black borders just because you chose a dark button color).
  • All sunken frames shade properly against the backdrop. Look at the inside of the line edits with the beauutiful brown texture base.
  • Radio buttons are drawn using QPainter::Antialiasing, which gives it a much smoother look than in Plastique.
  • You can set colors, gradients and brushes on any palette entry on any widget. The buttons on the left hand simply use a pink linear gradient or texture brush for the button's QPalette::Button palette entry. Notice the shading on the button bevel. Expensive? Yes, very. ;-) But luckily it's cached.
The code that generates a button used to be close to 180 lines of code. With Plastique2, it's 130 lines, and looks better, I think, anyway. :-) In general, all of the controls are drawn using less code. The radio buttons, for instance, were 72 lines, and check boxes were 89 lines of code. In addition, Plastique2 has something like 200-300 lines of inlined sprites. Now check boxes are 55 lines, and radio buttons are 33 lines, no sprites ;-).

On the right, you can see an editable combobox with a white Base and green Button, and one with a texture Base and a gradient Button.

If you have any suggestions to what we could do to make Plastique2 rock even more, please let me know! And thanks again to Sandro Giessl who authored the original style, Plastik, from which Plastique has emerged. Any day of working on Plastique is a day of pleasure. ;-)

PS: Whether Plastique2 will replace Plastique (and be renamed Plastique) is not yet known, and even whether Plastique2 will be part of Qt 4 at all, has not yet been decided. So keeping our politics in order, all disclaimers posted, everything you have seen is subject to change. :-)


Blog Topics:

Comments