PDA

View Full Version : QGraphicsView and animation framework



Diph
24th April 2010, 15:45
I have QWidget and QGraphicsView components in my program and I want to animate QWidget (move it on top of the graphics view). In animation framework example (http://doc.qt.nokia.com/qt-maemo-4.6/animation-states.html), widgets are placed in QGraphicsScene and then animated. I tried to put both QWidget and QGraphicsView in scene but then the graphics view is really slow.

Are there alternative ways to animate the UI than putting the widgets in the scene? QGraphicsView in QGraphicsView doesn't sound like such a good idea. :D

Lykurg
24th April 2010, 17:31
QGraphicsView in QGraphicsView doesn't sound like such a good idea. :D
Right! You can use the animation also outside the graphics view. You can use setGeometry() and arrange your widgets manually and after the animation you can set them back in a layout (if needed).

Diph
24th April 2010, 17:56
Right! You can use the animation also outside the graphics view. You can use setGeometry() and arrange your widgets manually and after the animation you can set them back in a layout (if needed).
So which layout I should use? If I want to be able to move widget from outside of the window (hidden) to on top of the graphics view (which covers the whole window)?

wysota
24th April 2010, 22:22
Widgets can't be in a layout if you wish to move them. There is an alternative that you will implement your own layout class that will use the animation framework to synchronize moving widgets around.