Results 1 to 2 of 2

Thread: QSettings and colons in group name

  1. #1
    Join Date
    Dec 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QSettings and colons in group name

    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:
    Qt Code:
    1. [XX:XX:XX:XX:XX:XX]
    2. value=a:b:c:d:e:f
    To copy to clipboard, switch view to plain text mode 
    becomes
    Qt Code:
    1. [XX%3AXX%3AXX%3AXX%3AXX%3AXX]
    2. value=a:b:c:d:e:f
    To copy to clipboard, switch view to plain text mode 
    Does anyone know how to fix it? Or maybe with a different approach than QSettings?
    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QSettings and colons in group name

    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().

Similar Threads

  1. Group Box
    By bmn in forum Qt Programming
    Replies: 1
    Last Post: 5th May 2008, 11:36
  2. Migrate Qt3 QSettings to Qt4 QSettings
    By hvengel in forum Qt Programming
    Replies: 3
    Last Post: 22nd February 2008, 03:21
  3. group box
    By me_here_me in forum Qt Programming
    Replies: 3
    Last Post: 7th September 2007, 19:28
  4. QAction group
    By mickey in forum Newbie
    Replies: 1
    Last Post: 12th July 2006, 19:15

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.