NameZero912
18th August 2012, 16:53
Hi,
I'm using the GraphicsView framework to realize a custom 2D GUI. I created the different menu screens in Photoshop, and separately exported the background image on the one hand, and transparent (PNG) images that I place in the different menu screens on the other hand. Each of my menu screen is realized by a class I created, which extends QGraphicsObject. In the QGraphicsView, where I setup the QGraphicsScene, I call
QGraphicsScene::setBackgroundBrush() on it to set the background image.
Since I want menu transitions in the "swipe left/right" fashion (i.e. one menu flies out of the view, e.g. to the left, and the next menu flies into the view from the right), I decided to arrange all the menus (QGraphicsObjects) spatially in the QGraphicsScene next to each other. Using the State machine framework and animations framework, I have one state per menu screen, and I'm assigning the QGraphicsView's sceneRect property to a QRectF for each state independently.
Generally this approach works, and I get smooth menu-to-menu transitions. However, the transitions do not look right. What I want (expect) is that the background image always stays static, "as it is" (regardless that sceneRect is animated), i.e. I'd expect that only the transparent parts of my menu screens are "flying" in/out of the view from the left/right. However, unforunately the background itself does also move, i.e. it is as if QT has taken a screenshot of the view right at the start, and one at the end of the animation, and then animate between the two screenshots.
Is there a way I can force the background to be completely static anyways?
Cheers!
I'm using the GraphicsView framework to realize a custom 2D GUI. I created the different menu screens in Photoshop, and separately exported the background image on the one hand, and transparent (PNG) images that I place in the different menu screens on the other hand. Each of my menu screen is realized by a class I created, which extends QGraphicsObject. In the QGraphicsView, where I setup the QGraphicsScene, I call
QGraphicsScene::setBackgroundBrush() on it to set the background image.
Since I want menu transitions in the "swipe left/right" fashion (i.e. one menu flies out of the view, e.g. to the left, and the next menu flies into the view from the right), I decided to arrange all the menus (QGraphicsObjects) spatially in the QGraphicsScene next to each other. Using the State machine framework and animations framework, I have one state per menu screen, and I'm assigning the QGraphicsView's sceneRect property to a QRectF for each state independently.
Generally this approach works, and I get smooth menu-to-menu transitions. However, the transitions do not look right. What I want (expect) is that the background image always stays static, "as it is" (regardless that sceneRect is animated), i.e. I'd expect that only the transparent parts of my menu screens are "flying" in/out of the view from the left/right. However, unforunately the background itself does also move, i.e. it is as if QT has taken a screenshot of the view right at the start, and one at the end of the animation, and then animate between the two screenshots.
Is there a way I can force the background to be completely static anyways?
Cheers!