I have a series of six JPEG images that I'd like to display on the same QGraphicsScene. Each grayscale JPEG is approximately 4000x3400 pixels and just under 700 KB in file size.
I'm wondering about the most memory-efficient way to place these six JPEGs as items in a single graphics scene. I've looked into adding them as QGraphicsPixmapItems using the following code:
Qt Code:
pixItem ->setPixmap(ncpPix); scene->addItem(ncpItem);To copy to clipboard, switch view to plain text mode
The problem is that the setPixmap() operation seems to consume more than 60 MB of memory for each new pixmap item I add to the scene. For six images, that's not really going to cut it. I've done some basic profiling of my application and the memory overhead of the graphics scene and graphics view is minimal - the problem is with setPixmap. What other options do I have for placing those JPEGs in the scene? Am I doing something terribly wrong? Are there straightforward steps I can take to decrease the memory footprint of displaying multiple JPEGs as items in a graphics scene?
NOTE: I'm using the stock Qt JPEG plugin to deal with the JPEG images.
Bookmarks