Results 1 to 4 of 4

Thread: Using QSettings fallback mechanism with custom filepaths

  1. #1
    Join Date
    May 2013
    Posts
    35
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Using QSettings fallback mechanism with custom filepaths

    Hello,

    I have an application into which I'm trying to implement QSettings to take advantage of two particular features: file loading / saving and the fallback mechanism. The existing config files follow INI format, and use the user / system scope hierarchy, but the files use .cfg (not .conf) for their extension. ATM, the only way I can see to override the default .conf extension QSettings uses is to set the path directly when the object is constructed. But, of course, that bypasses the fallback mechanism, which I want to use.

    Is there a way to specify a custom file path / file extension, but still use the built-in fallback mechanism?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using QSettings fallback mechanism with custom filepaths

    QSettings uses .conf when the format is NativeFormat or .ini when the Format is IniFormat.

    As far as I can tell the only way to use a different extension is to use a different, custom, format.

    Cheers,
    _

  3. #3
    Join Date
    May 2013
    Posts
    35
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Using QSettings fallback mechanism with custom filepaths

    That's what I was afraid of... Of course, that negates the purpose of implementing QSettings. Ah well.

    Thanks!

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using QSettings fallback mechanism with custom filepaths

    If you are in need for more advanced config handling you could have a look at the KConfig addon module: http://www.inqlude.org/libraries/kconfig.html

    I can do multiple levels of fallbacks, merge values from different levels, mark entries as immutable by more local files, has a code generator for getting rid of using string based access in application code, etc.

    Cheers,
    _

Similar Threads

  1. QSettings custom class serialization problem
    By sakya in forum Qt Programming
    Replies: 1
    Last Post: 19th December 2011, 11:00
  2. Replies: 1
    Last Post: 14th January 2011, 11:57
  3. Replies: 6
    Last Post: 7th December 2010, 12:32
  4. Store an custom enum in QSettings
    By Lykurg in forum Qt Programming
    Replies: 1
    Last Post: 14th March 2007, 20:06
  5. Can we have IPC mechanism ?
    By vijay anandh in forum Qt Programming
    Replies: 3
    Last Post: 3rd May 2006, 19:26

Tags for this Thread

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.