Qt Code:
  1. void Fraga::contextMenuEvent(QGraphicsSceneContextMenuEvent* e)
  2. {
  3. QMenu menu;
  4. QPoint p= (mapToParent(e->scenePos())).toPoint();
  5. menu.addAction(_nyttsvar);
  6. menu.exec( p );
  7. }
To copy to clipboard, switch view to plain text mode 

Fraga is an QGraphicsRectItem. This is the code, but it doesn't seem to get maped to the correct coordinatesystem. A call to the above function places the menu outside of the Mainwindow, which is not exactly what I had hoped for.
The menu should be placed close to the mouse cursor, of course. But I don't know how.