title: QGraphicsScene image pos pixmap
body: <p>I am using Qt Graphics Framework for displaying an image. I have opened a raw image in subclassed <code>QGraphicsScene</code> in <code>QGraphicsView</code> using <code>addPixmap()</code>. I have added zoom feature by using scale function and drag mode is set as scroll hand drag. Now, I need to get the pixel coordinates within the scene on mouse hover such that the x and y value show the pixel in the image (drawn by pixmap) the mouse is currently pointing to. I tried using <code>pos()</code> but it didn't work.</p>
  
  <p>Here is the code from <code>Widget.cpp</code>:</p>
  
  <pre><code>img = openImage(dirPath2.toLocal8Bit().data(),
                  sizeX,sizeY,file_heade,scan_heade,bpp,sign);
  QPixmap x = QPixmap(sizeX,sizeY);
  x.convertFromImage(img,Qt::AutoColor);
  scene-&gt;addPixmap(x);
  ui-&gt;disp_img-&gt;setDragMode(QGraphicsView::ScrollHandDrag);
  </code></pre>
  
  <p><code>GraphicsScene.h</code>:</p>
  
  <pre><code>class GraphicsScene : public QGraphicsScene {
  public:
      GraphicsScene(QWidget *parent) : QGraphicsScene(parent){}
  };
  </code></pre>
  
  <p>(preferably the pixmap coordinates but even that doesn't happen and if the values change when zoomed I will use scale factor to get the original values)</p>