我正在编写一个程序,该程序将包含一个用户列表,每个用户都将拥有来自在线资源的自己的图片。我正在成功下载数据,但我正在努力格式化图片格式。它成功地保存了文件,但它没有以可读的格式保存。
void FriendsListProcess::picRequesFinished(QNetworkReply *reply)
{
QByteArray data = reply->readAll();
if(reply->error())
{
qDebug() << reply->errorString();
return;
}
emit savePic(pic_name_path,data);
reply->deleteLater();
}
void FriendsListProcess::savePicToFile(QString file, QByteArray &pic_data)
{
qDebug() << "File name from write pic: " << file;
QFile f(file);
if(f.open(QIODevice::WriteOnly))
{
QDataStream out(&f);
out << pic_data;
f.close();
}
}
当我尝试打开保存的文件窗口时说
"Windows Photo Viewer can't open this picture because either Photo Viewer doesn't support this file format. or you don't have the lates updates to Photo Viewer"
你们有什么建议吗?