Results 1 to 8 of 8

Thread: Value from QSettings

  1. #1
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Value from QSettings

    How to get value from key with space ?

    Qt Code:
    1. conf->beginGroup("lambung");
    2. qDebug() << conf->value("milik saya", "").toString()
    3. conf->endGroup();
    4. //result ""
    To copy to clipboard, switch view to plain text mode 

    I just get empty string. If I get the all keys, the key will visible

    Qt Code:
    1. conf->beginGroup("lambung");
    2. qDebug() << conf->childKeys();
    3. conf->endGroup();
    4. //result ("milik saya", "milik kamu", "milik dia")
    To copy to clipboard, switch view to plain text mode 

  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: Value from QSettings

    Put the key in quotes.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Re: Value from QSettings

    Well, i found the problem. "milik saya" value have a ",". And like you advise, I put the value in quotes
    Thank's

  4. #4
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: Value from QSettings

    I get a new problem. Every time i set the value, space ini keyname will change with %20. How to fix it ?

  5. #5
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Value from QSettings

    I think that You must read QSettings doc. All Your's problems are described.

  6. #6
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Re: Value from QSettings

    You think so ? What must i do ? setIniCodec ? I did, but still not work. Or you have any solution in QSettings doc. Please tell me..

  7. #7
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Value from QSettings

    As in original definition of INI files in the Microsoft Windows for Workgroups Resource Kit section and key names cannot contain spacing characters. So Qt workarrounds this by changing spaces to %20 string (hex code of space). Is this a problem ?

  8. #8
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Re: Value from QSettings

    Yes. If not I don't post my question

Similar Threads

  1. QSettings.
    By afflictedd2 in forum Qt Programming
    Replies: 1
    Last Post: 5th April 2009, 20:14
  2. Migrate Qt3 QSettings to Qt4 QSettings
    By hvengel in forum Qt Programming
    Replies: 3
    Last Post: 22nd February 2008, 04:21
  3. QSettings::value() does not return value.
    By zEeLi in forum Qt Programming
    Replies: 3
    Last Post: 11th June 2007, 11:25
  4. Qsettings
    By jrideout in forum Qt Programming
    Replies: 11
    Last Post: 29th June 2006, 20:21
  5. QSettings
    By incapacitant in forum Newbie
    Replies: 13
    Last Post: 25th May 2006, 12:08

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.