Good Morning All,

My app deals with burrowing down to the R G B pixel data in successive video frames. The frame analysis takes place in a dialog where method ShowFrame renders a zoomed QPixmap to screen.

My problem is I cannot get the QPainter to zoom the pixmap.
Qt Code:
  1. void IconDialog::ShowFrame(QString aFrameNm, int Zoom)
  2. {
  3. FrameNm = aFrameNm;
  4. scene->clear();
  5. Frame.load(aFrameNm);
  6. scene->setSceneRect(Frame.rect());
  7. QPixmap pixmap = QPixmap::fromImage(Frame);
  8. if (Zoom > 1) {
  9. QRectF sr = pixmap.rect(); //source rectangle
  10. int w = qRound(sr.width()/Zoom);
  11. int h = qRound(sr.height()/Zoom);
  12. QRectF tr; //target rectangle
  13. tr.setX(sr.width()-w);
  14. tr.setY(sr.height()-h);
  15. tr.setWidth(w);
  16. tr.setHeight(h);
  17. if (p.begin(this)) {
  18. p.drawPixmap(tr, pixmap, sr);
  19. p.end();
  20. }
  21. else {
  22. QMessageBox::information(0, "Error IconDialog", "Statement p.begin(this) failed, I don't know why.");
  23. }
  24. }
  25. item = new QGraphicsPixmapItem(pixmap);
  26. scene->addItem(item);
  27. ui->FrameGV->show();
  28. }
To copy to clipboard, switch view to plain text mode 
What ever I try results in activating the QMessageBox, I cannot find a "last error" or a reason for failure.
I have followed the usual procedures to resolve the issue but without success.

I believe my code is at fault, I have missed something, but what?

Hope you can help.

Thank you.

Regards
Glen