Hello,

I'm trying to make a simple game to learn how to use QGraphicsScene. I want it to be the typical asteroid shooting game where you are a ship and you fly around.

What I'm interested in learning how to do is also to dynamically add and control items in the QGraphicsScene. Currently, I am aware that we can do something along the lines of

Qt Code:
  1. QGraphicsPixmapItem *bkgimg = scene->addPixmap(pixmap);//pretty background image
To copy to clipboard, switch view to plain text mode 

(pixmap was defined earlier) and then we can say

Qt Code:
  1. bkgimg->setPos(0,0);
To copy to clipboard, switch view to plain text mode 

if we want to move it around.


My question is can I add an item to QGraphicsScene sort of like this:
Qt Code:
  1. scene->addItem(QGraphicsItem(300,300));
To copy to clipboard, switch view to plain text mode 

where 300,300 are the x and y positions and be able to modify that item later on? Or perhaps there is a way to dynamically declare objects and add them to QGraphicsScene and use signals/slots to update their position?

Thanks