Thanks! That explains the loop from hell: setScene() and show() were causing paintEvents in the paintEvent.
But I still do not understand how to get the QPixmap into the QGraphicsView.
I moved QGraphicsView and QGraphicsScene out of the paintEvent so that they only get called once.
I moved QPixmap so it is available to the class.
I got rid of the view->show() since I do not think it is needed.
But I still do not see the image in the QGraphicsView.
Am I getting closer at least?

Qt Code:
  1. ViewerDialog::ViewerDialog(QWidget *parent) :
  2. QDialog(parent),
  3. ui(new Ui::ViewerDialog)
  4. {
  5. ui->setupUi(this);
  6. ...
  7. pixmap = new QPixmap(ui->view->size());
  8. scene = new QGraphicsScene(ui->view);
  9. }
  10. ...
  11. void ViewerDialog::updateUi()
  12. {
  13. ...
  14. scene->setSceneRect(ui->view->rect());
  15. ui->view->setScene(scene);
  16. scene->addPixmap(*pixmap);
  17. }
  18. ...
  19. void ViewerDialog::paintEvent(QPaintEvent *e)
  20. {
  21. QPainter painter(pixmap);
  22. vector<SyDataT>::iterator it;
  23. for (it = sy->syVector.begin(); it < sy->syVector.end(); it++)
  24. {
  25. if ((pl == it->pl) && (fr == it->fr))
  26. {
  27. ...
  28. QColor color(red, green, blue, alpha);
  29. painter.setPen(color);
  30. painter.drawPoint(it->az, it->el);
  31. }
  32. }
  33. }
To copy to clipboard, switch view to plain text mode