Results 1 to 2 of 2

Thread: Using Qsettings to read legacy settings format and write it in QSettings format

  1. #1
    Join Date
    Sep 2008
    Posts
    54
    Thanks
    3
    Thanked 10 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Using Qsettings to read legacy settings format and write it in QSettings format

    If have an old program that uses a custom (XML like) format for reading writing settings.

    I would like to use the QSettings normal format so I do not have to maintain readers and writers for that format.

    So using a custom format I read the settings file and have all my key/value pairs.

    Is it possible to use the same QSettings object and set the format to QSettings::NativeIni and write the settings?

    QSettings::setDefaultFormat (QSettings::IniFormat); ignores IniFormat and sets the format to the one specified with the creation of the settings object and thus the Custom format that I want to get rid of.

    Now I think I have to create a new QSettings object and read/write all values from the old settings object to the new one to be able to save to Ini.

    Regards,

    Marcel

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Using Qsettings to read legacy settings format and write it in QSettings format

    Yes, you can't change the backend of an existing object. You have to copy all the data to a new object. QSettings::allKeys() will be helpful.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 6
    Last Post: 7th December 2010, 12:32
  2. Replies: 2
    Last Post: 2nd September 2009, 13:36
  3. Opendocument format read/write *.odt
    By patrik08 in forum Qt Programming
    Replies: 7
    Last Post: 17th September 2008, 00:48
  4. QSettings, my own format of config-file
    By IPFreely in forum Qt Programming
    Replies: 2
    Last Post: 14th November 2007, 20:07
  5. Replies: 4
    Last Post: 1st February 2006, 17:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.