illuzioner
29th June 2007, 19:36
hi,
has anyone successfully, in its paintEvent, drawn over a QPushButton?
void MyButton::paintEvent(QPaintEvent *Event)
{
QPainter painter(this);
QPushButton::paintEvent(Event);
QRect buttonRect=rect();
painter.setBrush(QBrush(Qt::red,Qt::SolidPattern)) ;
painter.drawRoundRect(buttonRect,20,20);
painter.drawText(0,0,w,h, Qt::AlignRight | Qt::AlignVCenter,QString("Button"),&buttonRect);
}
the code after the QPushButton:: paintEvent(Event) doesn't seem to do anything.
now, take out line 4 and you can see that the code works. strange.
anybody know how to fix this? stylesheets won't work for me in this case.
thanks! -- lou
has anyone successfully, in its paintEvent, drawn over a QPushButton?
void MyButton::paintEvent(QPaintEvent *Event)
{
QPainter painter(this);
QPushButton::paintEvent(Event);
QRect buttonRect=rect();
painter.setBrush(QBrush(Qt::red,Qt::SolidPattern)) ;
painter.drawRoundRect(buttonRect,20,20);
painter.drawText(0,0,w,h, Qt::AlignRight | Qt::AlignVCenter,QString("Button"),&buttonRect);
}
the code after the QPushButton:: paintEvent(Event) doesn't seem to do anything.
now, take out line 4 and you can see that the code works. strange.
anybody know how to fix this? stylesheets won't work for me in this case.
thanks! -- lou