You can use QImage basically the same way as QPixmap. Main difference between these two classes is that QPixamp is stored in the server side (i.e. xwindow manager side) while QImage is independent. Also QPixmap is optymized for display and QImage optymized for I/O and pixel manipulation. That's why You can't use QPixmap in the non GUI thread.
About usage, QImage is essentially used same as QPixmap, but depending on what You want to use it for sometimes conversion is needed to QPixmap.
For example, I used QImage to create thumbnails of the images in another thread like:
//code in non GUI thread
thumb = (tmp.scaled( sizeW, sizeH ).scaled( sizeW, sizeH, Qt::KeepAspectRatio, Qt::SmoothTransformation ));
//code in non GUI thread
QImage thumb, tmp;
thumb = (tmp.scaled( sizeW, sizeH ).scaled( sizeW, sizeH, Qt::KeepAspectRatio, Qt::SmoothTransformation ));
To copy to clipboard, switch view to plain text mode
To display QImage in QLabel use something like this:
ui
->label
->setPixmap
( QPixmap().
fromImage( tmp
) );
QImage tmp;
ui->label->setPixmap( QPixmap().fromImage( tmp ) );
To copy to clipboard, switch view to plain text mode
Bookmarks