Results 1 to 4 of 4

Thread: Most Memory-Efficient Way to Add Images to QGraphicsScene?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Most Memory-Efficient Way to Add Images to QGraphicsScene?

    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:
    1. QPixmap ncpPix(ncpPath);
    2. pixItem ->setPixmap(ncpPix);
    3. 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.
    Last edited by datek2517; 28th June 2011 at 03:49.

Similar Threads

  1. Replies: 2
    Last Post: 28th April 2012, 08:58
  2. most efficient way to get a QPixmap from a QImage
    By caduel in forum Qt Programming
    Replies: 3
    Last Post: 11th June 2011, 12:00
  3. how to load images from phone memory
    By trupti in forum Qt Programming
    Replies: 11
    Last Post: 7th January 2011, 11:24
  4. QGraphicsScene - memory consumption
    By mateuszzz88 in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 29th November 2010, 20:39
  5. QGraphicsScene - order of images drawn
    By bjh in forum Qt Programming
    Replies: 2
    Last Post: 29th November 2007, 15:41

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.