Hi!

I have my own subclass of QGraphicsView which displays a QGraphicsScene. I add lines on the scene. Now I also want do add QImages to the scene (or view).
I have tried the following:
I overode QWidget:: paintEvent(QPaintEvent*) in my QGraphicsView subclass:
Qt Code:
  1. void myViewSubclass:paintEvent(QPaintEvent * event) {
  2. QGraphicsView::paintEvent(event);
  3. QPainter painter;
  4. painter.begin(this);
  5. QPointF point(GetCenter().x(), GetCenter().y());
  6. painter.drawImage(point, *image);
  7. painter.end();
  8. }
To copy to clipboard, switch view to plain text mode 
Unfortunately Qt Creator tells me:
QPainter::begin: Widget painting can only begin as a result of a paintEvent
But I only paint in the above method which IS the result of a paint Event...
Where is my mistake? Or is my aprroach to drawing an image on the scene rubbish anyway?