Hello, I'm trying to implement a simple class to draw things:
Draw.h:
Qt Code:
  1. #ifndef DRAW_H
  2. #define DRAW_H
  3. #include <QWidget>
  4. //------------------------------------
  5. class Canvas : public QWidget
  6. {
  7. Q_OBJECT
  8. public:
  9. Canvas(QWidget *parent = 0);
  10. protected:
  11. void paintEvent(QPaintEvent *e);
  12. private:
  13. QImage image;
  14. };
  15. #endif // DRAW_H
To copy to clipboard, switch view to plain text mode 
Draw.cpp:
Qt Code:
  1. #include <QPainter>
  2. #include "draw.h"
  3. //-------------------------------------------
  4. Canvas::Canvas(QWidget *parent) : QWidget(parent)
  5. {
  6. }
  7. //-------------------------------------------
  8. void Canvas::paintEvent(QPaintEvent *e)
  9. {
  10. QPainter p(this);
  11. QRect r = e->rect(); // error: invalid use of incomplete type 'struct QPaintEvent'
  12. p.drawImage(r, image, r);
  13. }
To copy to clipboard, switch view to plain text mode 

I don't understand this error. Incomplete type??
What am I doing wrong?

Thank you.