Hi all,

I use QuaZip to process ZIP archives. Eventually I have to write new archives to disc, and make absolutely sure of success before I proceed. As I understand, from Qt 5.1, QSaveFile is intended to accomplish this. This stackoverflow post suggests that QSaveFile indeed implicitly ensures the file is synced to disc.

Now, though I do question some of QSaveFile's design decisions, this post is about pragmatic solutions.

I am looking for a way - with as little effort as possible - to safely write a QuaZip to disc. QuaZip does provide a ctor that takes a QIODevice. However, as the QuaZip::close() docs state:
The underlying QIODevice is also closed, regardless of whether it was set explicitly or not.
QSaveFile not only overrides access to close() as private, but also does this:
Qt Code:
  1. /*!
  2.   \reimp
  3.   Cannot be called.
  4.   Call commit() instead.
  5. */
  6. void QSaveFile::close()
  7. {
  8. qFatal("QSaveFile::close called");
  9. }
To copy to clipboard, switch view to plain text mode 
which crashes my appplication when QuaZip::close() implicitly calls QIODevice::close() on the QSaveFile.

Any suggestions appreciated.