hi syed,
there are a whole bunch of examples in the Qt installation folder with sources, try to run one of them and walk through the code, you will be able to solve this on your own :)
Also can you markup your code by enclosing them within @ tags, easier to read