hi,
has anyone successfully, in its paintEvent, drawn over a QPushButton?
{
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
);
}
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);
}
To copy to clipboard, switch view to plain text mode
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
Bookmarks