I'd say the code should be:
Qt Code:
  1. void Shot::newShot(QGraphicsScene * scene, double x, double y)
  2. {
  3. ball = new QGraphicsEllipseItem(-5,-5,10,10);
  4. scene->addItem(ball); // adds new item to the scene, not to the GraphicsItem("cannon")
  5. ball->setPos(x,x);
  6. }
To copy to clipboard, switch view to plain text mode