I am new to QT, I have tried a lot to look for samples of how to get a button draw event in QT .. I do not get a way to do this.
How to set delegates for a button in QT ?. How to get a drawing event for a button?
I read so many articles, he says that we can get a button draw event, which we can also customize. but i did not get a piece of code how to get a drawing event.
I am trying to make this example, on a sub class, but I am not getting an event. please tell me I'm wrong
class Mybutton:QPushButton
{
public:
Mybutton(QObject *parent = 0){}
void paintEvent ( QPaintEvent * );
};
void Mybutton::paintEvent(QPaintEvent* Paint)
{
Paint->rect();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QPushButton *Newbutton = new QPushButton();
Newbutton->move(20,30);
Newbutton->show();
return a.exec();
}
still i can't get events.
please help me with this.
thank
source
share