Problem related to paint event?
-
In my button class i am creating custom button using paint event but in some cases i want normal button. So the problem is that once i
am including paint event function in my button class the normal button disappear. what is the solution to get normal button? -
So, don't use an empty definition, but use
@
void MyButton::paintEvent(QPaintEvent* pe)
{
if (do_own_drawing) {
//blah, do the drawing
} else {
QPushButton::paintEvent(pe); //assuming your button class inherits QPushButton
}
}
@By the way, did you know that you can also customize the rendering of exiting buttons using style sheets? Not sure what you want to achieve, but that might be easier if you just want to modify the rendering of the button.