使用QuaZip需要zlib跟QuaZip网上都有可以直接看如何编译
编好的QuaZip放入工程目录下
修改pro文件添加这段话
INCLUDEPATH += $$PWD/QuaZip/include
LIBS += -L$$PWD/QuaZip/lib -lquazip
导入QuaZip头文件
#include <JlCompress.h>
压缩
void compressDir(QString path)
{
JlCompress::compressFile(path + "/test.zip",path + "/test.txt");
// JlCompress::compressFiles(QString fileCompressed, QStringList files);
// JlCompress::compressDir(QString fileCompressed, QString dir);
}
解压
void extractDir(QString path)
{
// JlCompress::extractFile(QString fileCompressed, QString fileName);
// JlCompress::extractFiles(QString fileCompressed, QStringList files);
JlCompress::extractDir(path + "/test.zip", path);
}