PDA

View Full Version : Value from QSettings



wirasto
13th January 2010, 17:47
How to get value from key with space ?



conf->beginGroup("lambung");
qDebug() << conf->value("milik saya", "").toString()
conf->endGroup();
//result ""


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



conf->beginGroup("lambung");
qDebug() << conf->childKeys();
conf->endGroup();
//result ("milik saya", "milik kamu", "milik dia")

wysota
13th January 2010, 18:01
Put the key in quotes.

wirasto
13th January 2010, 18:22
Well, i found the problem. "milik saya" value have a ",". And like you advise, I put the value in quotes :)
Thank's

wirasto
13th January 2010, 22:18
I get a new problem. Every time i set the value, space ini keyname will change with %20. How to fix it ?

Lesiok
14th January 2010, 10:03
I think that You must read QSettings doc (http://doc.trolltech.com/4.6/qsettings.html). All Your's problems are described.

wirasto
14th January 2010, 13:12
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..

Lesiok
14th January 2010, 18:29
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 ?

wirasto
14th January 2010, 18:52
Yes. If not I don't post my question