Friday, March 09, 2007

Reflections

In the spirit of my never ending "pimp your Qt application" series comes another example. This time, "how to make iTunes-like album selector". It's funny how much attention this widget got. I looked at it yesterday on one of the Macs at the office and just implemented it. I probably should make it a view for a list model but for now it's just a simple widget. It runs at perfectly smooth 60 frames per second while utilizing ~7% cpu on my 3GHz Pentium4 with NVIDIA GeForce 6600, so by no means a monster of a machine. Oh, and of course this is all done with pure Qt. Reflections are actually a vector effect, so they would work equally well for any vector based graphics (by using the same code as this example, you can reflect your svg's or even whole widgets with no problem). Mandatory screenshot:
And as with every animated example a movie (again, framerate of the screencapture does not come close to the real world performance) is available here . Finally the code is available here.

12 comments:

Anonymous said...

Thanks, part of the code actually answered a completely different question I had planned to ask you already.

Tackat

Stecchino said...

Wow Zack, wonderful, this will find it's way in Amarok 2.0.
You forgot to mention in your post the this requires Qt4.3 snapshots.

b10663r said...

Ahughahehg... (Homer's drool sound) Please, please, please, make sure it makes it in as a model view! We get tons of requests for this kind of eye candy.

Anonymous said...

Did anyone tell you you're great? This is beatifull , I really like it . Keep up the excellent work!

Anonymous said...

Amazing, keep up with the great work!

polonista said...

Anyone can provide static binary of this app?

Anonymous said...

WOW ZACK! YOU ARE THE BEST!! KEEP UP THE GOOD WORK!! :D

Anonymous said...

KDE 4 WILL TRULY ROCK THANKS TO YOU AND OTHER GUYS, THIS IS AWESOME!! :D

QT IS THE BEST WIDGET I EVER!!!

Viksit said...

this is brilliant :) can't wait for amarok 2.0 to come out!

Anonymous said...

Hei Dude, this is Marcelo from INDT, we met on Bossa! I hope you had a good flight back and also to meet you sooner than the next bossa!

Cheers!

Marcelo

Ueli said...

There's a small bug in the code..
have a look at drawItemsAfterSelected in browser.cpp.

for (int i = endIdx-m_selected, idx = endIdx-1;..

instead of

for (int i = endIdx-m_selected, idx = endIdx;...

should fix a crash when resizing the app.

Enjoy

butlimous said...

Thanks for the nice post!