I watched the ICS video on QGraphicsView and I do understand the relationship between child/parent items.
I traced the new items position and it starts at 0, and that would mean that it is a child of my reference item(the "cannon"). But I don't understand why, if I add it to the scene and not to the item(the "cannon").
{
scene->addItem(ball); // adds new item to the scene, not to the GraphicsItem("cannon")
}
void Shot::newShot(QGraphicsScene * scene, double x, double y)
{
ball = new QGraphicsEllipseItem(x,x,10,10);
scene->addItem(ball); // adds new item to the scene, not to the GraphicsItem("cannon")
}
To copy to clipboard, switch view to plain text mode
Why does that happen?
EDIT: Another thing I dont understand is this:
problem.png
between the walls is what the scene is supposed to be, 400x400. But it re-sizes to the whole view and the red cannon instead of being inside the scene, is outside. I set the app to fullscreen.
Bookmarks