Need: Read/Write a struct of standard Qt types from/to a human readable/editable file.
Tried: QSettings. It was fairly easy to get it working. Problem: QSettings automatically calls QSettings::sync() periodically, and at dtor. I am required to ensure that the settings file is only updated on request, and that run-time data structure is only modified on request.
Tried: QDataStream. Problem: Not human readable/editable.
Tried: Manual serialization and deserialization, using standard readline and QString::toInt() and such. I now have to support types that QSettings supports, but that QString does not have 'toFoo()' methods for. This way would be MUCH, MUCH more coding.
Is there a way to serialize and deserialize human-readable data without using QSettings? Everything about it is against requirements. The files are supposed to be named differently. Access is supposed to be controlled differently.
It would probably be enough, if there was simply a way to block sync(). We can probably work around anything else. It's "sync" that gives me the most problems.
QSettings
not as a member variable of your class, but a local variable which is created or deleted in different places of your code depending on your requirements. – TarodQTextStream
? – Dmitry Sazonov