Hi,

i have some trouble retrieving an item's position in scene coordinates.
currently the code looks like:

Qt Code:
  1. void view::mousePressEvent(QMouseEvent* event)
  2. {
  3. if (event->button()==Qt::LeftButton)
  4. {
  5. Vertex::Vertex* vertex = new Vertex::Vertex(QRect(event->x(), event->y(), 2, 2));
  6. vertex->setZValue(3);
  7. m_scene->addItem(vertex); // QGraphicsScene*
  8. std::cout << "Pos: " << vertex->pos().x() << " : " << vertex->pos().y() << std::endl;
  9. }
  10. }
To copy to clipboard, switch view to plain text mode 

but pos() always returns 0:0. i have read the documentation and tried a lot of things (setPos,mapToScene, scenePos..) but always retrieve a wrong or zero position.

which function do i have to call to retreive the coordinates set by event->x(), event->y() ?

thanks in advance