Results 1 to 5 of 5

Thread: store QSettings in XML for all platforms wanted

  1. #1
    Join Date
    Jul 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default store QSettings in XML for all platforms wanted

    I develope multiplatform portable application. It is targeted to Windows and Linux, but probably can appear for MAC OS. Application has to be portable and must work in any platform. In best case it can be written to SD or flash-memory, and statically linked executables for ALL supported platforms can appear on it. That means user inserts SD card to Linux machine - and starts work. Or he inserts SD to Windows machine and continues work. That's the idea...

    I have to save settings to SD card instead of save them to registry on Win-machine. The only one way is save INI file. But why this ancient INI format is the only one I can use? Of course saving settings in XML is much more modern and useful than INI. It is native for MAC. And finaly, instead of INI - XML is multiplatform standard...

    Why there is no native ability save settings in XML on ALL supported platforms??? XML support code is well developed for Linux and Windows, and it already exists in Qt MAC's build. Why just not include this code to Qt libraries for all platforms and define QSettings::XmlFormat for QSettings::Format enum?

    Please tell me why this hasn't been done yet???
    Last edited by nilir; 1st July 2010 at 12:38.

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: store QSettings in XML for all platforms wanted

    There's no such facility mainly because Windows doesn't support XML preferences. Also because QSettings is designed to be a cross-platform preferences-storage mechanism, so the implementations that are actually in use on supported platforms for storing such information were used. Preferences are stored in a blocked, non-hierarchical format on all platforms; using XML for such a simple format is overkill.

    If you want to store XML, just store your XML document in a QString, and assign it as the value of a single key in the QSettings object. Or, just store it in a text file and write your own parser for it.

  3. #3
    Join Date
    Jul 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: store QSettings in XML for all platforms wanted

    But INI is not native for MAC OS... and what?...

    As I can see many Qt-programmers prefer XML format for settings. Even there are some third party solutions using QDOMElement. They aren't so useful. But if there is no needed tool - then people try make one. Most useful will be native support in Qt. Just implement QSettings::XmlFormat for all platforms. Viola! Lot's of people will tell THANK YOU!!

  4. #4
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: store QSettings in XML for all platforms wanted

    QSettings is meant to produce standards-compliant preference files on the platforms it supports.

    If you want to save and restore your very own XML files, there are ample tools availble that let you do that on yourself; if you use the various Qt XML tools, they're cross-platform, to boot. Why you need to use XML to parse a simple key/value, non-hierarchical text file escapes me, but there's nothing stopping you.

  5. #5
    Join Date
    Jul 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: store QSettings in XML for all platforms wanted

    My settings file is rather hierarchical, not just simple key-value pairs. Now there are 3 levels of hierarchy and it can increrase.

    I'm pretty sure programmers have to have choice which one format use. I create multiplatform application using multiplatform toolkit Qt. This application must work on any platform, including MAC OS. But INI files on this platform ar not standard.

    Of course I'll use thrid party XML extension for while. Yes, I'll not use INI-format which TT/Nokia created for this. Like many other people around. And I'll not remove my request to implement XML multiplatform support under cover of Qt.

Similar Threads

  1. Multiple platforms
    By ctote in forum Qt Programming
    Replies: 8
    Last Post: 15th February 2010, 19:48
  2. How to unify the QT style in different platforms?
    By yangyunzhao in forum Qt Programming
    Replies: 7
    Last Post: 5th August 2009, 11:23
  3. Store an custom enum in QSettings
    By Lykurg in forum Qt Programming
    Replies: 1
    Last Post: 14th March 2007, 20:06
  4. What platforms are you using Qt on?
    By gfunk in forum Qt Programming
    Replies: 7
    Last Post: 8th February 2007, 15:47
  5. Compiling on different platforms
    By Tori in forum Newbie
    Replies: 1
    Last Post: 25th January 2006, 22:09

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.