jano_alex_es
3rd February 2011, 15:54
Hello,
I'm doing a game with items in a QGraphicsScene - QGraphicsView. The scene is the entire level, it's big, so the view is following the main character when it's going outside the boundaries.
But I want to have a static widget (a button) in the bottom-left part of the screen (view). So the view is focusing in the main character but that widget keeps its position on the screen.
I though I could achieve that by calculating (each frame) the QGraphicsView position in the screen and place the button in the proper scene coordinate.
So far I tried with QWidget::pos() and QGraphicsView::sceneRect() but it's no use.
How can I know the position the view is showing of the scene every frame, or, if so, there is any way to have a QGraphicsPixmap item statically in the view?
thanks!
I'm doing a game with items in a QGraphicsScene - QGraphicsView. The scene is the entire level, it's big, so the view is following the main character when it's going outside the boundaries.
But I want to have a static widget (a button) in the bottom-left part of the screen (view). So the view is focusing in the main character but that widget keeps its position on the screen.
I though I could achieve that by calculating (each frame) the QGraphicsView position in the screen and place the button in the proper scene coordinate.
So far I tried with QWidget::pos() and QGraphicsView::sceneRect() but it's no use.
How can I know the position the view is showing of the scene every frame, or, if so, there is any way to have a QGraphicsPixmap item statically in the view?
thanks!