[Qt-interest] update qgraphicsscene

Esben Mose Hansen kde at mosehansen.dk
Mon May 24 21:35:39 CEST 2010


On Monday 24 May 2010 19:43:20 caius ligarius wrote:

> I tried creating a QGrpahicsScene member variable which belongs to the same
> class as the above function but the problem I ran into was that everytime I
> updated the scene with the new image (scene->additem(qGraphicsItem)) the
> image got shifted and was not centered around the viewport.
> 
> My questions is what is the most optimal way (in terms of speed and memory
> management) to update QGraphicsView widget with a new QImage?

Set the new image on "qGraphicsItem", and update the "scene" with 
setSceneRect() to match the bounds to avoid the off-center effect.


-- 
Kind regards, Esben



More information about the Qt-interest-old mailing list