title: Why the QGraphicsPixmapItem exists offset when use fitInView() function?
body: <p>I use fitInView() function to view the image pixels, but image pixels exists offset, how to solve this problem?</p>
  
  <pre><code>void QtGraphicsView::setViewRect(const QRectF &amp;rect)
  {
      if (m_viewRect == rect)
          return;
  
      m_viewRect = rect;
      fitInView(rect);
  }
  
  void QtGraphicsView::scaleView(qreal factor)
  {
      const QSizeF &amp;size = m_viewRect.size() / factor;
      if (size.width() &lt;= 0 || size.height() &lt;= 0
              || size.width() &gt;= sceneRect().width()
              || size.height() &gt;= sceneRect().height())
          return;
  
      const QSizeF &amp;dsize = m_viewRect.size() - size;
      const QPointF &amp;topLeft = m_viewRect.topLeft()
              + QPointF(dsize.width() / 2, dsize.height() / 2);
      setViewRect(QRectF(topLeft, size).toRect());
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/MVi17.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MVi17.png" alt="enter image description here"></a></p>