QSettings : custom ini file
I'm on Windows XP.
I'm using Qsettings in order to save properties. Those properties has different types (int, QSTring, bool...). When I use a classical QSettings that is basically stored on windows registered, no problem. But when i try to use an INI file, the types of settings ar lost (that's any ascii file so only char).
I would like to know if it's possible to custom this file in order to give the type of each dtata stored in it.
An ini file is a text file so you can just get string.
You use QString functions
@toDouble ( )
toInt ( )
toLong ( )
toShort ( )@
or for boolean
@bool mybool = (myString=="true")?true:false;@
That means I can't know the type of data I put into it I guess....
I hope you know the type of data you put into
That means also that string is type of string and nothing else.
Try to use group (aka the 'key' in QSettings i think)
That's an intersting idea. I already use the arborescence but it could be usefull.
Anyway, after 4 hours looking for a solution about the ini file, if anyone gets the same idea I got, it doesn't seam possible to modify its protocol to put the type into it.
I'll check on give this informations by the groups or write my own writing function.
You should use class named "QVariant":http://doc.trolltech.com/4.7/qvariant.html
ini files work without problems for me. You'll have to use QSettings setValue and value methods.