Qt 内で zip ファイルを開いて操作するために QuaZip を使用する人の数はわかりませんが、次のコードを使用して zip ファイルを開こうとしています。
#include "quazip/JlCompress.h"
#include <QDebug>
#include <QtWidgets>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ConnectActions();
...
}
bool MainWindow::LoadArchive(const QString &filename)
{
//qDebug() << "STUB: LoadArchive()";
QuaZip archive_handle(filename);
//Attempt to open the file, return false and display error message
if(!archive_handle.open(QuaZip::mdUnzip)) {
qDebug() << "Archive does not exist or is damaged!";
return false;
}
//Perform some sort of operation, such as loading the images out of the archive
//tidy up
archive_handle.close();
return true;
}
エラーが表示されます:
QIODevice::open: File access not specified
Archive does not exist or is damaged!
***Error in `/home/adrian/Development/build-CinemaStrips-Desktop_Qt_5_3_GCC_64bit-Debug/CinemaStrips': free(): invalid pointer: 0x00007f2c4b709ce0***
The program has unexpectedly finished.
API の手順は非常に単純で、コードで逐語的に従っているため、ステップが抜けているかどうかはわかりません。ご覧のとおり、私は Qt5 を使用しています。QuaZip は 4 でしか動作しませんか? 最後に、誰もが経験したことのある Qt で zip ファイルを操作する別の方法はありますか?
ありがとう!