Skip navigation.
KDE Developer's Journals

Transparent, Super smooth Qt4Clock :: Experiment

siraj's picture

Link to My Home page for More screenshots

After seeing cairo clock.. I wanted to simulate the same thing using Qt4 .. just
to show how simple it is to do it with new Qt 4.1.1. it's a matter of getting a
transparent widget (using few Xlib commands and drawing on it with QPainter paint commands (Clock hands and Clock face) with Time.
and I was amazed by the smooth ness and the images quality of the output
and also the speed at it was happening.Most of all it's almost Zero length code to achive this effect (less than 400 lines) and the Clock glass is drawn using only Qt4
paint commands. I'm going to place some screenshots
and also the source for this simple two classed clock whitch is a
nince a eye -kandy, too sad to send it to trash can I shoudl some make it more usable!. I think this also shows that wonder full things to come with KDE 4 UI's and widgets .. and plasma.











well, 2007 is going to be a busy year for KDE artists!...for sure..
I will put some clock themes and source on my home page..I must draw the date
and also wirite some Keybord event listners, so that some one can use it.More clock stuff

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
naresh's picture

Nice!

It looks realy nice! I can't wait for the source... Why won't you move to berlios? It works realy nice and i had no problems witch cvs/svn. Please msg me if you post the source code. It can help while developing my software

siraj's picture

Ok..I released the source

ok..done!
it's a very simple. Qt Application. only 3 classes . this is a educational application for
and i'm using XRender. and works when a composite manager is running.
remember this is not portable..I'm using X extention exclusively to render that
transparent background.
u can download the GPL source of this clock from my home page.

http://www.linuxlots.com/~siraj/qtclock.html (download Link updated)

if u do make any interesting modifications ..please let me know also!

bye
Siraj Razick

naresh's picture

Hi Siraj! I've found out

Hi Siraj! I've found out quite nice thing in Qt4. Try out this code

#include <QApplication>
#include <QLabel>
#include <QPixmap>
#include <QBitmap>

int main(int argc, char *argv[]) {
        QApplication app(argc, argv);
        QLabel label;
        QPixmap px("/full/path/to/clocks/board.png"); // it should have some transparent places
        label.setPixmap(px);
        label.setMask(px.mask());
        label.show();
        app.exec();
}

casper's picture

Hi machan

hi siraj

i am bhagya

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.