Results 1 to 12 of 12

Thread: Qsettings

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qsettings

    Quote Originally Posted by jrideout
    The application is being rewritten to be deployed on different machines over the network...
    Oh, I see now. In that case I think your tactic of writing your own class using the QSettings API is a good one.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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

    Unfortunately simply subclassing QSettings won't help you because none of its methods are virtual. I think you should just implement a class simmilar to QSettings and substitute all occurences of QSettings in the code. Of course your class can still use QSettings to provide compatibility with the "usual" settings storage methods.

  3. #3
    Join Date
    Feb 2006
    Location
    Boulder, Colorado, USA
    Posts
    63
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qsettings

    Quote Originally Posted by wysota
    Unfortunately simply subclassing QSettings won't help you because none of its methods are virtual. I think you should just implement a class simmilar to QSettings and substitute all occurences of QSettings in the code. Of course your class can still use QSettings to provide compatibility with the "usual" settings storage methods.
    Quote Originally Posted by jrideout
    I ... wrote my own class that has a similar api to QSettings
    Thanks, I did

  4. #4
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qsettings

    Quote Originally Posted by wysota
    Unfortunately simply subclassing QSettings won't help you because none of its methods are virtual. I think you should just implement a class simmilar to QSettings and substitute all occurences of QSettings in the code. Of course your class can still use QSettings to provide compatibility with the "usual" settings storage methods.
    Right but there is a static method called registerFormat() that allows the creation of custom settings format without changing anything in the API, just implementing to functions...
    Current Qt projects : QCodeEdit, RotiDeCode

  5. #5
    Join Date
    Feb 2006
    Location
    Boulder, Colorado, USA
    Posts
    63
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qsettings

    Quote Originally Posted by fullmetalcoder
    Right but there is a static method called registerFormat() that allows the creation of custom settings format without changing anything in the API, just implementing to functions...
    But, registerFormat() assumes that the format is of a file on the hard disk, you can't change that, of course you could set the file to /dev/null, or something but you'll have all sorts of issues or at least lost functionality with the conflict/locking stuff that Qsettings uses, plus it really isn't designed for it.

    What I wanted was to store the data in a database, regardless of format (meaning I don't care about the format, not I want a generic use any format class). To do that I implemented a new (not derived) class which has a similar, but not entirely same api as QSettings, this enabled me to migrate a very large codebase over a day or so.

Similar Threads

  1. QSettings
    By incapacitant in forum Newbie
    Replies: 13
    Last Post: 25th May 2006, 11:08
  2. QSettings vs (QFile + Qtextstream)
    By nupul in forum Newbie
    Replies: 5
    Last Post: 10th April 2006, 07:26
  3. Replies: 4
    Last Post: 1st February 2006, 17:17
  4. QSettings again ... how to remove array elements
    By Mike in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 08:58
  5. QSettings - beginReadArray not working
    By Mike in forum Qt Programming
    Replies: 7
    Last Post: 9th January 2006, 21:24

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.