Results 1 to 2 of 2

Thread: QSettings : rename/copy a group recursively

  1. #1
    Join Date
    Feb 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QSettings : rename/copy a group recursively

    Hi everybody !

    I am looking for a way to directly rename (or at least copy recursively) a group in a QSettings (in my case, a Windows registry arborescence).
    I found a trick here : http://www.qtcentre.org/threads/4677...xml-Copy-group but using ChildKeys only permit to copy direct keys, of course...

    Is there any way to rename a group ?

    For instance, I "manually" copy each elements from one path to another, but I will prefer to copy directly the group (in case of future evolutions, adding keys).

    Thanks for future answers.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QSettings : rename/copy a group recursively

    As the QSettings documentation says, you can use the childGroups() / childKeys() methods to recursively traverse a settings hierarchy.

    To rename a group, I think you would have to first retrieve the group under the old name, then add it using the new name, then delete the old name. Alternatively, retrieve the entire hierarchy into a tree structure, rename those things you want to rename, then delete the old settings and write out the tree as new ones.

    I don't see any direct methods to rename groups or keys.

Similar Threads

  1. QSettings: copy from ini to xml? Copy group?
    By TorAn in forum Qt Programming
    Replies: 1
    Last Post: 11th January 2012, 14:51
  2. Replies: 1
    Last Post: 24th June 2011, 11:11
  3. Replies: 2
    Last Post: 1st March 2011, 17:00
  4. QSettings and colons in group name
    By anthon in forum Qt Programming
    Replies: 1
    Last Post: 15th August 2010, 18:01
  5. Copy/Rename project
    By thtran_usa in forum Qt Tools
    Replies: 2
    Last Post: 26th December 2009, 20:46

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.