title: QEvent Signal and Slot
body: <p>I created a Qt Project and I added a QPushButton with a style I customized with QEvent and QMouseEvent. I added a slot to this button but it doesen't work.
  Here is a project like mine:</p>
  
  <p>Header 1:</p>
  
  <pre><code>#ifndef MYQPUSHBUTTON_H
  #define MYQPUSHBUTTON_H
  
  #include &lt;QPushButton&gt;
  #include &lt;QPalette&gt;
  
  class myQPushButton : public QPushButton
  {
  Q_OBJECT
  public:
  explicit myQPushButton(QWidget *parent = 0);
  ~myQPushButton();
  void enterEvent(QEvent* );
  void leaveEvent(QEvent* );
  void mousePressEvent(QMouseEvent *  );
  void mouseReleaseEvent(QMouseEvent *  );
  
  signals:
  
  public slots:
  
  private:
  QPalette *palette;
  };
  
  #endif // MYQPUSHBUTTON_H
  </code></pre>
  
  <p>Header 2:</p>
  
  <pre><code>#ifndef MAINWINDOW_H
  #define MAINWINDOW_H
  
  #include &lt;QMainWindow&gt;
  #include "myQPushButton/myqpushbutton.h"
  
  namespace Ui {
  class MainWindow;
  }
  
  class MainWindow : public QMainWindow
  {
  Q_OBJECT
  
  public:
  explicit MainWindow(QWidget *parent = 0);
  ~MainWindow();
  
  private:
  Ui::MainWindow *ui;
  myQPushButton *button;
  };
  
  #endif // MAINWINDOW_H
  </code></pre>
  
  <p>Source 1:</p>
  
  <pre><code>#include "myqpushbutton.h"
  
  myQPushButton::myQPushButton(QWidget *parent) :
  QPushButton(parent)
  {
  setFixedSize(200,200);
  setIconSize(QSize(200,200));
  setIcon(QIcon("D:/clockbox/qt/clockbox/exit_button_wwin_norm.png"));
  setFlat(true);
  
  }
  
  myQPushButton::~myQPushButton()
  {
  
  }
  
  void myQPushButton::enterEvent(QEvent* )
   {
  setIcon(QIcon("D:/clockbox/qt/clockbox/exit_button_wwin_enter.png"));
   }
  
   void myQPushButton::leaveEvent(QEvent* )
   {
  setIcon(QIcon("D:/clockbox/qt/clockbox/exit_button_wwin_norm.png"));
   }
  
   void myQPushButton::mousePressEvent(QMouseEvent * )
   {
  setIcon(QIcon("D:/clockbox/qt/clockbox/exit_button_wwin_pressed.png"));
   }
  
   void myQPushButton::mouseReleaseEvent(QMouseEvent * )
   {
  setIcon(QIcon("D:/clockbox/qt/clockbox/exit_button_wwin_enter.png"));
   }
  </code></pre>
  
  <p>Source 2:</p>
  
  <pre><code>#include "mainwindow.h"
  #include &lt;QApplication&gt;
  
  int main(int argc, char *argv[])
  {
  QApplication a(argc, argv);
  MainWindow w;
  w.show();
  myQPushButton y;
  QObject::connect(y, SIGNAL(clicked()), &amp;w, SLOT(close()));
  
  return a.exec();
  }
  </code></pre>
  
  <p>Source 3:</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  
  MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::MainWindow)
  {
  ui-&gt;setupUi(this);
  button = new myQPushButton(this);
  setCentralWidget(button);
  }
  
  MainWindow::~MainWindow()
  {
  delete ui;
  }
  </code></pre>
  
  <p>I get this error on source 2:</p>
  
  <p>error: no matching function for call to 'QObject::connect(myQPushButton&amp;,   const char*, MainWindow*, const char*)'
    QObject::connect(y, SIGNAL(clicked()), &amp;w, SLOT(close()));
                                                            ^</p>
  
  <p>I want this button to be an exit button. Somebody can help me?</p>