Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved]Problem in QSettings with no sorting
QtWS25 Last Chance

[solved]Problem in QSettings with no sorting

Scheduled Pinned Locked Moved General and Desktop
sortingqsettings
3 Posts 2 Posters 3.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    beidaochuan
    wrote on last edited by beidaochuan
    #1

    I used QSetting::childGroups() to get all items in INI file.
    for example:

    // my.ini
    [a]
    a = 1
    [c]
    c = 2
    [b]
    b = 3
    

    I want to get the order a c b,
    but i got abc.
    how can I resolve the problem?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alex_malyu
      wrote on last edited by
      #2

      I afraid order is and should not be preserved.
      If you need a specific order you data is not grouped properly and you you need to change relation from siblings to parent child,
      Otherwise it is impossible to achieve for general case.
      For example you have 0 control over keys order in Windows registry (and QSettings can be used to write settings there).

      So if you really insist on having specific order do not use QSettings.

      B 1 Reply Last reply
      0
      • A alex_malyu

        I afraid order is and should not be preserved.
        If you need a specific order you data is not grouped properly and you you need to change relation from siblings to parent child,
        Otherwise it is impossible to achieve for general case.
        For example you have 0 control over keys order in Windows registry (and QSettings can be used to write settings there).

        So if you really insist on having specific order do not use QSettings.

        B Offline
        B Offline
        beidaochuan
        wrote on last edited by
        #3

        @alex_malyu
        i will add unique id to every group and add group to QStringList so that i can get a order childGroup.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved