I have inherited Qpushbutton to make it circular shape, if I set background in paintevent of this class it works fine but I want to set different image for each instant of this class so I tried setting it by seticon and setstylesheet but it does not work. What could be the reason. please help me out. Thanks in advance.
this is my code.
CirclularButton::CirclularButton(QWidget *parent):QPushButton(parent)
{
}
void CirclularButton::paintEvent(QPaintEvent *e)
{
QPainter p(this);
p.setRenderHints(QPainter::Antialiasing);
p.drawEllipse(0, 0, 50, 50);
}
and in another class where I am using it,
CirclularButton *cir = new CirclularButton(this);
cir->setGeometry(50,50,50,50);
cir->setStyleSheet("border:1px solid red");