I want to Save Configuration Settings to XML file in QT and read it from there ?
What is best approach to do this in QT ?
Any sample/ideas are highly appreciated.
Thanks.
I want to Save Configuration Settings to XML file in QT and read it from there ?
What is best approach to do this in QT ?
Any sample/ideas are highly appreciated.
Thanks.
For such things I often use the boost library for C+ and can highly recommend it. It offers serialization for various formats like XML, text, binary etc.
Serialization Tutorial (looks more complicated that it actually is)
You can register your XML file format with
QSettings::registerFormat
Here's a sample implementation of the
readXmlFile
andwriteXmlFile
There is Qt examples for XML.
Also you can use QSettings to store your settings.
Here is my code for exporting settings to XML. What you need is to call
ExportSettingsToXml()
with opened for writing QFile. The exported file can be imported again withImportSettingsFromXml()
.