How to get the painting event for buttons in QT


i am new to QT, i tried lot searching samples of how to get the button paint event in QT.. i am not getting the way to do it..

how to set the delegates for pushbutton in QT?. how to get the paint event for pushbutton?

i read so many articles, it says we can get the paint event of button we can customize too. but i didnt get the piece of code how to get the paint event..

i try doing this sample, by sub classing still i am not getting event. please tell me whre m i wrong

  class Mybutton:QPushButton
    Mybutton(QObject *parent = 0){}
    void paintEvent ( QPaintEvent * );


void Mybutton::paintEvent(QPaintEvent* Paint)



int main(int argc, char *argv[])
    QApplication a(argc, argv);

    QPushButton *Newbutton = new QPushButton();

    return a.exec();

still i am not able to get the events.

please helpe me in this.


You need to subclass QPushButton and reimplement paintEvent().