PDA

View Full Version : QGraphicsView Problem



hakkman
14th June 2008, 00:06
I'm writing a little app that takes aerial photos and constructs something like a google map out of them. I'm adding QPixmapItems to my graphics scene, and the scene is connected to a qgraphicsview. Everything works great until I scale or rotate the qgraphicsview, the performance just goes to absolute crap. The qtdemo "ported canvas" seems to be able to zoom and rotate pixmaps without any loss of performance at all. Of course, I'm using 6megapixel pictures, not little tiny pixmaps, but I wouldn't expect it to get so slow. Anyone have any ideas what I'm doing wrong?

With rotating, if I rotate back to the initial orientation, the performance goes back up, with zooming (calling qgraphicsview->scale and using scaling factors 0.5 and 1.5) as soon as I scale it the first time, it gets realy slow, and scaling back to the original scale still results in slow performance.

Any help with this would be greatly appreciated - this is a bit of a rush job - has to be working by next week :(

Thanks
Andrew

wysota
14th June 2008, 07:14
Try enabling QGraphicsItem::DeviceCoordinateCache for your items. Cutting images into smaller pieces should help too. Using fast pixmap transform mode should increase the speed significantly. Finally use QGLWidget as the viewport if you have hardware accelerated graphics card available (you probably do) - this should give you a big boost in speed.

hakkman
14th June 2008, 20:27
I tried turning on the device coordinate caching. Same problem. Scrolling works fine before anything is transformed, and takes > 10 seconds when any transformation is being applied to the pixmaps. I think for the first version of the program for this week, I'll just skip the map and just have a list of pictures and display them one at a time, and disable zooming. I would still like to figure this out for later though.

I could try a smaller image too...

Andrew