Hi,

Trying to override a QPushbutton with my own custom class. This qpushbutton belongs to a qwidget that I have overrided in UI editor. The problem is I am getting an error. Here are the classes:

Mytitlebar class that has children qpushbuttons:

#ifndef MYTITLEBAR_H
#define MYTITLEBAR_H

#include <QWidget>

class myTitleBar : public QWidget
{
Q_OBJECT
public:
explicit myTitleBar(QWidget *parent = 0);

protected:
void paintEvent(QPaintEvent *);
void mouseDoubleClickEvent( QMouseEvent * e );


signals:
void toggleViewSignal();

public slots:
};

#endif // MYTITLEBAR_H

#include "mytitlebar.h"
#include <QStyleOption>
#include <QPainter>
#include <QDebug>
#include <QMouseEvent>




myTitleBar::myTitleBar(QWidget *parent) : QWidget(parent)
{
//this->setStyleSheet("QWidget {color:white; background: qlineargradient(spreadad, x1:0, y1:0, x2:0, y2:1 stop:0 rgba(170, 0, 0, 255), stop:1 rgba(0, 0, 0, 255)); padding-bottom:5px;} ");



}

void myTitleBar:aintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}

void myTitleBar::mouseDoubleClickEvent(QMouseEvent * e )
{
if ( e->button() == Qt::LeftButton )
{
qDebug() << "double click pressed";

emit toggleViewSignal();

}
}


And the extended pushbutton class thats giving an error:

#ifndef MYPUSHBUTTON_H
#define MYPUSHBUTTON_H

#include <QPushButton>
#include "mytitlebar.h"

class myPushButton : public QPushButton
{

Q_OBJECT
public:

explicit myPushButton(QPushButton *parent = 0);


protected:

void focusInEvent(QFocusEvent *e) override;
};

#endif // MYPUSHBUTTON_H
#include "mypushbutton.h"
#include "mytitlebar.h"
#include <QDebug>

myPushButton::myPushButton(QPushButton *parent):QPushButton(parent)
{

}

void myPushButton::focusInEvent(QFocusEvent *e)
{
qDebug() << "focus pushbutton pressed";
}


Not sure why it errors out when compiled?

Thanks