Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save Configuration Settings to XML file in QT?

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.

like image 524
Bokambo Avatar asked Jul 06 '11 08:07

Bokambo


People also ask

How do I create an XML file in Qt?

To write XML document with QXmlStreamWriter, you start a document with the writeStartDocument() function and end it with writeEndDocument(), which implicitly closes all remaining open tags.

Does Qt use XML?

Qt provides two general-purpose sets of APIs to read and write well-formed XML: stream based and DOM based. Qt also provides specific support for some XML dialects.


2 Answers

You can register your XML file format with QSettings::registerFormat

Here's a sample implementation of the readXmlFile and writeXmlFile

like image 141
Imran Avatar answered Oct 08 '22 15:10

Imran


There is Qt examples for XML.

Also you can use QSettings to store your settings.

like image 23
AlexDenisov Avatar answered Oct 08 '22 13:10

AlexDenisov