PDA

View Full Version : QSettings and colons in group name



anthon
15th August 2010, 17:11
Hi
I'm using QSettings to parse an INI formated file generated by an external application. The groups in that file are all MAC adresses, like [XX:XX:XX:XX].
Reading this file with QSettings works great. Now I want to do some modifications in that file. The problem is, when QSettings writes in it, it replaces all ":"(colon) in the groups name by the code "%3A". However, colons in values fields are written properly so this is not strictly an encoding issue (besides I tried using "setIniCodec", it didn't help).
Example:

[XX:XX:XX:XX:XX:XX]
value=a:b:c:d:e:f
becomes

[XX%3AXX%3AXX%3AXX%3AXX%3AXX]
value=a:b:c:d:e:f
Does anyone know how to fix it? Or maybe with a different approach than QSettings?
Thanks.

Lykurg
15th August 2010, 19:01
It's not easy to change that because it is defined in a private class function: QSettingsPrivate::iniEscapedKey(). So if you develop a closed source application you can simply change it here, otherwise you have to write your own writing function and register it with QSettings::registerFormat().