[Interest] Write QSettings to a QString in INI format

Kai Köhne Kai.Koehne at qt.io
Fri Oct 25 17:29:45 CEST 2019


> -----Original Message-----
> From: Interest <interest-bounces at qt-project.org> On Behalf Of Murphy, Sean
> Sent: Thursday, October 24, 2019 5:53 PM
> To: interest at qt-project.org
> Subject: [Interest] Write QSettings to a QString in INI format
> 
> I'd like to be able to have QSettings write out my settings to an INI file format,
> but I'd like to avoid writing it to an actual file, instead just writing it to
> "something" in memory (for example, a QString, QByteArray, QBuffer, etc.).
> 
> [...]
> So I guess I can use QFile to create my own file, do what I need to do, then
> remove it myself when I'm done, but is there any alternative way to get what I
> want - QSetting written to a QString?

There are overloads of QFile::open() that take a system file handle / file descriptor. This one can point to memory. Anyhow, I guess you'll end up with platform specific code there ...

Kai



More information about the Interest mailing list