QPixmap.loadFromData(...) fails for a valid PNG
QPixmap.loadFromData(...) fails when trying to load a PNG from a byte array retrieved from a database. The PNG appears valid because after writing the bytes to a file it opened correctly in a PNG viewer.
The code is as follows:
pixmapReturn.loadFromData((const uchar *)diagram.c_str(),strlen(diagram.c_str()),"PNG");
If you dump it to a file like in your test, but then load it with
QPixmap::load()does it work?
What class is
My guess is that
strlendoesn't return what you expect. That function returns the length of a string which is determined by the terminating null-character. The binary data of an image can contains myriads of null-character.