I'm trying to show an image in QGraphicsView, but for some reason the top-right corner starts in the middle of the QGraphicsView.
Also, how to make it fit the QGraphicsView?

Here's my code:

Qt Code:
  1. Mat frameMat;
  2. videoReader >> frameMat;
  3.  
  4. _graphicsScene = make_unique<QGraphicsScene>(0, 0, 300, 300);
  5. ui.graphicsView->setScene(_graphicsScene .get());
  6. _graphicsScene ->setBackgroundBrush(Qt::blue);
  7.  
  8. QImage qImg(frameMat.data, frameMat.cols, frameMat.rows, frameMat.step, QImage::Format_RGB888);
  9. auto pixImg = QPixmap::fromImage(qImg);
  10.  
  11. auto item = new QGraphicsPixmapItem(pixImg);
  12. _graphicsScene ->addItem(item);
To copy to clipboard, switch view to plain text mode 

Here what I get when I run my code:
Untitled.jpg