PDA

View Full Version : Animation of QPainterpaths in QGraphicsScene in QGraphicsView



geowaverider
27th January 2012, 18:33
Hi

I've pretty much got the end game with my "Teach Yourself Qt" project and need some advice on animation of profiles in Qt.

I have a number of 2D profiles described by lines and arcs created as QPainterPaths starting at (0,0), and all created on a separate QGraphicsScene.

The bounding rectangles of all of these QPainterPaths are different.

When I show the QGraphicsScenes in order on the QGraphicsView I want the original QPainterPath origin to be located at the same point in the QGraphicsView.

I suppose it is analogous to an animation about a fixed point.

The problem is that each QGraphicsScene gets automatically centered at each iteration which moves the required QGraphicsScene fixed point about the QGraphicsView and I don't get the required effect.

Anyone have any thoughts?

Thanks

Brian

geowaverider
28th January 2012, 13:38
Hi

I've programmed a workaround to calculate the maximun bounding rectangle for each QGraphicsScene by a read through the data before displaying it and then adding this maximum bounding rectangle to each QGraphicsScene when it is displayed. It works as expected now, but it's a bit of a chicken before the egg solution :-).

I have experimented with MapFromScene and MapToScene suspecting that may offer a solution but with little sucess.

Brian