[Qt-interest] QSettings from QByteArray

Andre Somers andre at familiesomers.nl
Mon Feb 8 09:44:47 CET 2010


Jeffrey Brendecke wrote:
>> Is there way to read ini formated QSettings directly from QByteArray
>> instead of file?
>>
>> Br. Marko
>>     
> Check out QBuffer.
>   

I don't think it is that easy, as QSettings does not have a constructor 
that takes a QIODevice but only one that takes a QString for the file name.
One way may be to extend QSettings using QSettings::registerFormat, and 
have your ReadFunc and WriteFunc use your own QIODevice instead.
Another (rather ugly) workaround could be to write out your QByteArray 
to a temporary file, and read that using QSettings.

André





More information about the Qt-interest-old mailing list