I have a QGraphicsView with a set QGraphicsScene. I'm trying to get the coordinates (on mouseover) of where the mouse is relative to the scene. I'm able to get the coordinates of the entire screen, but not the scene. Is there any way to accomplish this?

This is the code I have so far, but it only returns the window coordinates:
Qt Code:
  1. bool Form::eventFilter(QObject *o, QEvent *e)
  2. {
  3. if (o = ui.graphicsView->viewport()){
  4. QPoint a = QCursor::pos();
  5. QString coord = QString::number(a.x()) + ", " + QString::number(a.y());
  6. ui.coordLabel->setText(coord);
  7. }
  8. }
To copy to clipboard, switch view to plain text mode