Redraw text in custom widget removes button functionality (QPushbutton inherited) [SOLVED]
When deriving from QPushbutton all my QSS is applied as my paintevent is working. However when I insert my paintevent, Text is no longer drawn instead. Below is my paint event I use to draw the Push button however I am not sure if I am missing something to use this command on a derived QPushbutton.
@void GUIButton::paintEvent(QPaintEvent* aEvent)
Do I need to change the QStyle::PE_Widget to another QStyle ?
Figure out my problem however have created another problem because of it instead of actually having a button the button has now completely disappeared below is a simple example to show the problem.
Custom_Button::Custom_Button(QWidget *parent) :
void Custom_Button::paintEvent(QPaintEvent* aEvent)
class Custom_Button : public QPushButton
explicit Custom_Button(QWidget *parent = 0);
void paintEvent(QPaintEvent* aEvent);
#endif // CUSTOM_BUTTON_H
MainWindow::MainWindow(QWidget *parent) :
mainCustom_Button * Button = new Custom_Button(); //QPushButton *Button = new QPushButton(); QVBoxLayout * layout = new QVBoxLayout(); layout->addWidget(Button); QWidget * CenterWidget = new QWidget(); setCentralWidget(CenterWidget); centralWidget()->setLayout(layout);
Everything else is just a standard project, now what I am seeing is that the button isn't actually being drawn at all. If anyone has any idea why this is happening that would be great.