zgulser
10th May 2012, 16:13
Hi,
I have a QNetworkReply which contains a picture(PNG) as bytes.
The problem is; when I try to read all bytes in the the reply like ;
QPixmap pixmap;
pixmap.loadFromData(currentReply->readAll(), "PNG");
_tempForMSNAvatarLoading->setAvatar(pixmap);
it doesn't load the image.
However, if I first write the image to a QFile;
QFile temp("msn_temp_avatar.PNG");
if(temp.open(QIODevice::ReadWrite))
{
temp.write(currentReply->readAll());
}
and then pass the name of the file to the QPixmap like;
QPixmap pixmap(temp.fileName());
it works..
What might be the problem here?
I have a QNetworkReply which contains a picture(PNG) as bytes.
The problem is; when I try to read all bytes in the the reply like ;
QPixmap pixmap;
pixmap.loadFromData(currentReply->readAll(), "PNG");
_tempForMSNAvatarLoading->setAvatar(pixmap);
it doesn't load the image.
However, if I first write the image to a QFile;
QFile temp("msn_temp_avatar.PNG");
if(temp.open(QIODevice::ReadWrite))
{
temp.write(currentReply->readAll());
}
and then pass the name of the file to the QPixmap like;
QPixmap pixmap(temp.fileName());
it works..
What might be the problem here?