当前位置:网站首页>QT compressed folder
QT compressed folder
2022-04-23 05:30:00 【Oriental forgetfulness】
Adopted QZipWriter Of addFile To achieve .
First step :pro Add... To the file QT += gui-private
The second step : Add... To the header file :
#include <QtGui/private/qzipreader_p.h>
#include <QtGui/private/qzipwriter_p.h>
The third step :cpp Implementation in file :
bool zipDir(const QString& dirPath,QString SavePath)
{
bool ret;
QZipWriter *writer = new QZipWriter(SavePath);
if(QZipWriterEx(writer,dirPath,dirPath))
ret=true;
else
ret=false;
writer->close();
delete writer;
return ret;
}
bool QZipWriterEx(QZipWriter *writer, QString tmpPath, QString basePath)
{
QDir dir(tmpPath);
foreach (QFileInfo info, dir.entryInfoList())
{
if (info.fileName() == "." || info.fileName() == "..")
continue;
if (info.isFile())
{
QFile upfile(info.filePath());
upfile.open(QIODevice::ReadOnly);
QString fileName = info.filePath().mid(basePath.size()+1,info.filePath().size());
writer->addFile(fileName,upfile.readAll());
qDebug()<<fileName<<tmpPath<<basePath;
upfile.close();
}
else if (info.isDir())
{
QZipWriterEx(writer,info.filePath(),basePath);
}
}
return true;
版权声明
本文为[Oriental forgetfulness]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220543306776.html
边栏推荐
- egg的static的前缀是可以修改惹,靴靴
- 2021-10-08
- Three of three JS (webgl) is simple to draw lines / arcs according to points (based on linegeometry / line2 / linematerial, draw two arc segments based on the center of the circle)
- 创建进程内存管理copy_mm - 进程与线程(九)
- [triangle Yang Hui triangle printing odd even cycle JS for break cycle]
- Ehcache Memcache redis three caches
- 世界与个人发展
- Rog attack
- Laravel routing job
- X86 assembly syntax: at & T and Intel
猜你喜欢

Various situations of data / component binding

Laravel database

Domain driven model DDD (III) -- using saga to manage transactions
![[untitled]](/img/49/770888f4f351f42af0e01c3a15ddfa.png)
[untitled]

Box collapse and margin collapse

Fast application fuzzy search

領域驅動模型DDD(三)——使用Saga管理事務

Three 之 three.js (webgl)简单实现根据点绘制线/弧线(基于LineGeometry / Line2 / LineMaterial,绘制两点基于圆心的弧线段)

Arithmetic and logical operations

After NPM was upgraded, there was a lot of panic
随机推荐
Data bus realizes the communication between brother components
Open source rule engine - Ice: dedicated to solving flexible and complex hard coding problems
Cross domain CORS relationship~
2021-11-01
selenium預先加載cookie的必要性
[no title] Click the classification jump page to display the details
Laravel routing settings
Add two pointers? (legal or illegal)
Cross platform packaging of QT packaging program
CORS and proxy (づ  ̄ 3  ̄) in egg ~ the process of stepping on the pit and filling the pit ~ tot~
Interpretation of common SQL statements
After NPM was upgraded, there was a lot of panic
Nécessité de précharger les cookies dans le sélénium
The main difference between pointer and reference
On the use of constant pointer and pointer constant -- exercise (record)
Call the interface to get the time
The 2021 IT industry project management survey report was released!
Why can't V-IF and V-for be used together
Excel 2016 打开文件第一次打不开,有时空白,有时很慢要打开第二次才行
Three of three JS (webgl) simple sorting of rotation attribute function, and a simple case of rotating around the axis based on this