I have an application I'm writing using Qt 4.5.2 on Windows. I'm storing some settings in an INI file and using QSettings to load and save the settings. I'd like to have some comments in the INI file.
For example:
; Meta-info to store with the file
[General]
MainWindow\size=@Size(1280 600)
MainWindow\pos=@Point(0 300)
Debugging=true
However, I've found when I load the settings file with
QSettings settings( "settings.ini", QSettings::IniFormat );
the comments are stripped out of the file. The INI file is re-written after loading by a call to QSettings::sync() (this is done automatically by the constructor). Is there a way to preserve the comments after syncing?
Preemptive comments:
- I want INI files in Windows for future cross-platform compatibility
- I want to store meta-info in the file for reference outside of the application
- I am considering making the meta-info a section of the INI and using the name=value rules but would prefer to keep the information as a comment