Re: [Interest] Write QSettings to a QString in INI format

2019-10-26 Thread Henry Skoglund
On 2019-10-26 17:31, Murphy, Sean wrote: Because QSettings has the file locked. Make sure settings goes out of scope before you re-open the file. Granted, it's complex with the locking code, but underneath it all you have this hidden gem writeIniFile(), which takes a QIODevice and the map (you

Re: [Interest] ** Caution Message may be spoofed ** Re: Write QSettings to a QString in INI format

2019-10-26 Thread Murphy, Sean
> I suggest QTemporaryDir instead. Thanks Thiago, So just create the QTemporaryDir, then feed that path (along with an appended filename) to QSettings, allow it to create the INI file within the temporary directory, and then let QTemporaryDir clean up that directory when it goes out of scope?

Re: [Interest] Write QSettings to a QString in INI format

2019-10-26 Thread Thiago Macieira
On Saturday, 26 October 2019 02:43:48 PDT Konrad Rosenbaum wrote: > > So I if all the above is correct, and there is no way to write an INI > > formatted string to memory, and given the fact that I really don't want a > > file in the first place, I decided to look at writing the settings out to > >

Re: [Interest] Write QSettings to a QString in INI format

2019-10-26 Thread Murphy, Sean
> > Because QSettings has the file locked. Make sure settings goes out of > > scope before you re-open the file. > > > Granted, it's complex with the locking code, but underneath it all you have > this hidden gem writeIniFile(), which takes a QIODevice and the map (you > know, the function with tho

Re: [Interest] Write QSettings to a QString in INI format

2019-10-26 Thread Murphy, Sean
> This is basically the way to go. Thanks, although again I'd prefer to not have to do the actual file roundtrip, but it's not horrible. > > > > void MainWindow::writeSettings() > > { > > // comment/uncomment the *define* below to switch implementations > > #define USE_QTEMPORARY_FILE > > > > #i

Re: [Interest] Write QSettings to a QString in INI format

2019-10-26 Thread d3fault
On 10/24/19, Murphy, Sean wrote: > 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.). > If "something in

Re: [Interest] Write QSettings to a QString in INI format

2019-10-26 Thread Henry Skoglund
On 2019-10-26 11:43, Konrad Rosenbaum wrote: Hi, On 10/24/19 5:53 PM, Murphy, Sean wrote: 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 QSt

Re: [Interest] Write QSettings to a QString in INI format

2019-10-26 Thread Konrad Rosenbaum
Hi, On 10/24/19 5:53 PM, Murphy, Sean wrote: 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.). That's beca