Results 1 to 17 of 17

Thread: using QSettings to read an ini file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: using QSettings to read an ini file

    Yes, but as he said, he can't change the ini file...
    He will have to change the way QSettings deals with ',' ';' and '=' mamely, only stop on \r\n.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    5
    Thanked 86 Times in 81 Posts

    Default Re: using QSettings to read an ini file

    Probably he have to use QSettings::registerFormat() in order to create a "special" INI parser.

    QSettings has not virtual methods or properties to access the INI parser
    Last edited by mcosta; 20th July 2011 at 16:41. Reason: updated contents
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: using QSettings to read an ini file

    Probably he have to use QSettings::registerFormat() in order to create a "special" INI parser
    Yes, this looks like a good way to go.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    Join Date
    Sep 2010
    Posts
    13
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: using QSettings to read an ini file

    It looks like values that are separated by "," are returned as a QStringList, and not a QString by QSettings.

    Cast the return value to a QStringList and manipulate the value that way.

Similar Threads

  1. Read Several Groups in INI file from QSettings
    By deepal_de in forum Qt Programming
    Replies: 3
    Last Post: 5th July 2011, 09:43
  2. How to use QSettings to read INI file
    By Cantora in forum Newbie
    Replies: 8
    Last Post: 16th June 2011, 08:14
  3. Replies: 1
    Last Post: 14th January 2011, 11:57
  4. QSettings , read only avaiable?
    By patrik08 in forum Qt Programming
    Replies: 5
    Last Post: 18th November 2007, 15:21
  5. Using QSettings to read pre-made INI file..
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 05:36

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
  •  
Qt is a trademark of The Qt Company.