You are not logged in.

Dear visitor, welcome to If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.


Wednesday, August 18th 2004, 6:07am

Saving/Loading QImages

G'day all,
Just wondering if there was some way to get into the save/load routines of QImages, to be able to display a progress bar.
For instance, if I save an image that is 12mb, it takes a while, and at the moment I plan to run it in its own thread so at least I don't get ui lag issues, but it would be nice if I could display a progress bar or something similar as it saves.

Anyone have any ideas on how to do this?
Thanks in advance,



  • "djanubis" is male

Posts: 1,370

Location: Moulins France

Occupation: Software ingeneering

  • Send private message


Wednesday, August 18th 2004, 7:02am

RE: Saving/Loading QImages

You cannot directly poke into QImage::save methods. So it seems to me that the simplest way would be subclassing QImage and add members:

Source code

bool QImage::visualSave ( const QString & fileName, const char * format, int quality = -1 ) const

bool QImage::visualSave ( QIODevice * device, const char * format, int quality = -1 ) const

or whatever name you need.
In the implementation, you create your progress bar and control it from the method.

You can also try using a personalized QImageIO object.
Never patch not working code. Rewrite it !
Never patch badly designed classes. Recreate them cleanly.
(Excerpts from Computing Bible)

Home of the Lab project



  • "axeljaeger" is male

Posts: 730

Location: Frankfurt Germany

Occupation: Student

  • Send private message


Wednesday, August 18th 2004, 10:08am

I think you have to this on your own nut I'd be very interested in this too for LOADING large images.
It's nice to be important but it's more important to be nice

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message


Wednesday, August 18th 2004, 10:47pm

You could write into a buffer (using QImageIO)and then user QUrlOperator to write to a file URL

Qt/KDE Developer
Debian User