Hi! If I have a pointer to a PNG image in RAM (and assuming I know the size of the image), would it be possible to create a QPixmap without having to write the PNG to the HD and then creating it again?
Thanks!
Hi! If I have a pointer to a PNG image in RAM (and assuming I know the size of the image), would it be possible to create a QPixmap without having to write the PNG to the HD and then creating it again?
Thanks!
you have the PNG image in RAM. but how is created?
if you have the image in a QByteArray you can use QPixmap::loadFromData().
Qt Code:
QPixmap pixmap; bool isLoaded = pixmap.loadFromData ( byteArray, "PNG", Qt::AutoColor ); if ( !isLoaded ) // errorTo copy to clipboard, switch view to plain text mode
The loader attempts to read the pixmap using the specified format. If the format is not specified (which is the default), the loader probes the file for a header to guess the file format.
Bookmarks