Ok guys! Got the solution...Basically, in this case we have to reimplement the paintEvent() method. This has become a must in Qt4 since it is a pure virtual function, which was not the case in Qt3.