Results 1 to 5 of 5

Thread: QtSettings and QStringList

  1. #1
    Join Date
    Aug 2011
    Posts
    38
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QtSettings and QStringList

    Hi,

    is there any way strip this

    key=['5555','4444','5555']

    to 555,4444,5555 ? When my program reads this settings from ini with using QSettings class it will procude a QStringList which has next items:

    0 ['5555'
    1 '4444'
    2 '5555']

  2. #2
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QtSettings and QStringList

    are you sure that is proper ini format?
    you might have to put the value after '=' in double quotes and deal with the parsing of that string yourself.
    key="['5555','4444','5555']"
    or prevent the '[' and ']' to go into the ini file in the first place.

  3. #3
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: QtSettings and QStringList

    How do you read and write the settings file (provide some code)?

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

    Default Re: QtSettings and QStringList

    Assuming you can't get the INI file to be more what you would like to have, as schitzel suggested.

    Iterate over the list, use QString::section(), separator character ' and section index 1.

    Cheers,
    _

  5. #5
    Join Date
    Aug 2011
    Posts
    38
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QtSettings and QStringList

    ok,

    I do have a project which transform a project from another language to Qt. Seems to that I have to format break in here.

    thanks.

Similar Threads

  1. Help QStringList
    By pcoliver in forum Qt Programming
    Replies: 0
    Last Post: 15th September 2011, 10:15
  2. Plz help me,I met a bug about QStringList
    By study_c in forum Qt Programming
    Replies: 1
    Last Post: 16th October 2010, 15:56
  3. QStringList
    By jaca in forum Qt Programming
    Replies: 5
    Last Post: 17th May 2008, 10:12
  4. QStringList
    By dragon in forum Newbie
    Replies: 2
    Last Post: 8th June 2007, 17:26
  5. Replies: 7
    Last Post: 2nd June 2006, 12:48

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.