Hi, I'm new to Qt so please bare with me for a second here, and thank you for reading onward.

I'm trying to create a simple application in Qt Creator 5.1.0, which displays a 'Draw' button and upon clicking it will draw something. For the button: I just drag & drop a simple pushButton in Qt Designer.

Here is my header mydrawbutton.h
Qt Code:
  1. #ifndef MYDRAWBUTTON_H
  2. #define MYDRAWBUTTON_H
  3.  
  4. #include <QMainWindow>
  5. #include <QPainter>
  6.  
  7. #include "ui_mydrawbutton.h"
  8.  
  9.  
  10. class mydrawbutton : public QMainWindow, public Ui::mydrawbutton
  11. {
  12. Q_OBJECT
  13.  
  14. public:
  15. explicit mydrawbutton(QWidget *parent = 0);
  16. ~mydrawbutton();
  17. protected:
  18. void drawShape(QPaintEvent *);
  19.  
  20. private slots:
  21. void draw();
  22.  
  23. private:
  24. Ui::mydrawbutton *ui;
  25. bool m_draw;
  26. };
  27.  
  28. #endif // MYDRAWBUTTON_H
To copy to clipboard, switch view to plain text mode 

and source mydrawbutton.cpp:
Qt Code:
  1. #include <QPushButton>
  2.  
  3. #include "mydrawbutton.h"
  4.  
  5.  
  6. mydrawbutton::mydrawbutton(QWidget *parent) :
  7. QMainWindow(parent)
  8. {
  9. setupUi(this);
  10. m_draw = false;
  11. connect(drawButton, SIGNAL(clicked()), this, SLOT(draw()));
  12. }
  13.  
  14. mydrawbutton::~mydrawbutton()
  15. {
  16. delete ui;
  17. }
  18.  
  19.  
  20.  
  21. void mydrawbutton::drawShape(QPaintEvent *)
  22. {
  23. QPainter painter(this);
  24. if (!m_draw){
  25. painter.setPen( Qt::green );
  26. painter.setBrush( Qt::green );
  27. painter.drawRect(10, 10, 100, 100);
  28. }
  29. }
  30.  
  31. void mydrawbutton::draw()
  32. {
  33. m_draw = !m_draw;
  34. update();
  35. }
To copy to clipboard, switch view to plain text mode 

The problem is: when compile it does display the 'Draw' button, however nothing happened when clicking it. I've spent quite sometime reading around and trying to fix it, but haven't been able to make it work. Hope someone can help me fix it. Oh and if I'm missing any bits of information that you need, please tell me. Thank you!