Results 1 to 9 of 9

Thread: [QSettings] Why limiting to plain file or registry ?

  1. #1
    Join Date
    May 2006
    Posts
    55
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default [QSettings] Why limiting to plain file or registry ?

    Hi
    What about storing QSetings in something different from MS-Win registry or a plain file ?
    As QSettings offer to register a format in the form of a read and a write function dealing with a QDevice, why restrain the kind of device to only a QFile.
    What can be done to benefit from QSettings architecture (and .ini format handling) if one need to store configuration in something else, say a DB ?
    Thanks in advance.
    Laurent G.

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

    Default Re: [QSettings] Why limiting to plain file or registry ?

    But who says you're limited to .ini files and registry? That's what Qt uses, so that's what is implemented. Nobody forbids you from registering a different format. You can store data in a database using QIODevice too, so what is the problem?

  3. #3
    Join Date
    Jan 2006
    Posts
    21
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QSettings] Why limiting to plain file or registry ?

    And as always you can easily subclass QSettings to suit your needs.

  4. #4
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: [QSettings] Why limiting to plain file or registry ?

    A real DB may be overkill for just storing key-value pairs. And it begs the question, which DB? there's so many out there. The way it's been done is probably satisfactory for most common, light users, and follows familiar, standard conventions particular to each platform. And as always, it's extendable.
    Software Engineer



  5. #5
    Join Date
    May 2006
    Posts
    55
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [QSettings] Why limiting to plain file or registry ?

    Quote Originally Posted by wysota
    But who says you're limited to .ini files and registry? That's what Qt uses, so that's what is implemented. Nobody forbids you from registering a different format. You can store data in a database using QIODevice too, so what is the problem?
    Hi Wysota.
    The problem is the QIODevice is instanciated by QSettings and there is no virtual method/ entry point for changing that without rebuilding nearly the all things.
    I don't ask for Trolltech or anyone to implements the Db thing or so.
    I'd just like that have the .ini (this formats because it exists) formated 'virtual stream' to be stored where I fancy to dump it to and get it back decoded from where I can fetch it.
    I don't want to write another format, I'd just like to choose the underlying storage for it, and the registerFormat functions are no help in this case.
    But thanks answering
    Regards
    Laurent G.

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

    Default Re: [QSettings] Why limiting to plain file or registry ?

    Quote Originally Posted by lauranger
    Hi Wysota.
    The problem is the QIODevice is instanciated by QSettings and there is no virtual method/ entry point for changing that without rebuilding nearly the all things.
    Who forbids you from creating and using an own stream in the read or write functions?

  7. #7
    Join Date
    May 2006
    Posts
    55
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [QSettings] Why limiting to plain file or registry ?

    Quote Originally Posted by wysota
    Who forbids you from creating and using an own stream in the read or write functions?
    Having to rewrite a format (I did not see where to get "back" the read and write functions for .ini formats, in the public interface of QSettings) may not forbid, but just not encourage to use such a solution.

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

    Default Re: [QSettings] Why limiting to plain file or registry ?

    Quote Originally Posted by lauranger
    Having to rewrite a format may not forbid, but just not encourage to use such a solution.
    QSettings is intended for simple storage of configuration settings. Nobody says you have to use its interface. You can store your configs in an xml file with about the same amount of effort as using QSettings. It is just an interface for a dedicated solution.

  9. #9
    Join Date
    May 2006
    Posts
    55
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [QSettings] Why limiting to plain file or registry ?

    Quote Originally Posted by wysota
    QSettings is intended for simple storage of configuration settings. Nobody says you have to use its interface. You can store your configs in an xml file with about the same amount of effort as using QSettings. It is just an interface for a dedicated solution.
    Thank you for my freedom
    I used QSettings in a precedent project and I appreciated the easiness, the functionality, and
    was wondering it could fit with another storage. It don't. OK. Sigh Some more coding in perspective.

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.