我的开发平台是 win7
工具是QT Creator
版本是Qt Core 5.15.2
我采用内建的 QZipReader (#include "private/qzipreader_p.h")
来读取zip压缩档内的单一档案,然后显示
当读取压缩档内的bmp, png, jpg时
我用QImage来读取图片可成功读取
mPath = "F:/image/myzip.zip";
path = "myzip.zip/01.jpg";
mZipReader = new QZipReader(mPath);
QByteArray data{mZipReader->fileData(path)};
bool isSuccessed = image.loadFromData(data,"JPG");
但是如果要读取的档案是GIF档
则无论用QImageReader 或是 QMovie 都无法成功读取
mPath = "F:/image/myzip.zip";
path = "myzip.zip/1445806472.gif";
mZipReader = new QZipReader(mPath);
QByteArray data{mZipReader->fileData(path)};
QMovie *movie = new QMovie(data, "GIF");
qDebug() << movie->isValid(); //false
qDebug() << movie->lastErrorString(); //"File not found"
qDebug() << movie->fileName(); // "GIF89a\u0016\u0002B\u0001?"
想请问除了换用其他的lib之外,还有其他读取压缩档内gif可行的办法吗?
感谢阅读