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. Qsettings : get all applicationname
QtWS25 Last Chance

Qsettings : get all applicationname

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 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.
  • E Offline
    E Offline
    evergreen
    wrote on last edited by
    #1

    I wonder if there's a way to get all the applicationNames that corresponds to an organization name

    For instance, if two programs have declarered 2 Qsetting : QSettings ( "MyCompany","myAppv1") and QSettings ( "MyCompany","myAppv2") I would like to recover "myAppv1" "myAppv2" in one of them to be abble to compare the config.

    Is this possible? I can't find a solution in the doc or forums.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      You will have to write the comparison yourself. Once you have a QSettings instance pointing to a certain set of settings, you can get a list of all the keys and groups below it. You could probably find a way to get to the company level only on windows (due to the registry implementation), but on other platforms you would have to take a different approach considering the fact that settings files are used.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        anselmolsm
        wrote on last edited by
        #3

        Hm... In systems which use settings files, you probably will need something like this:

        @
        QSettings settings; // settings for the current app

        QFileInfo file(settings.fileName());
        QDir dir(file.absolutePath());
        qDebug() << dir.entryList(QDir::Files);
        @

        The output of this qDebug would list the settings files of all applications registered under the same organization name. For example, if all apps use the default QSettings path on Linux, this qDebug will list all files in $HOME/.config/OrganizationName/.

        Better ideas, anyone?

        Anselmo L. S. Melo (anselmolsm)

        1 Reply Last reply
        0
        • E Offline
          E Offline
          evergreen
          wrote on last edited by
          #4

          I won't have any problem to compare them I think.
          The real problem is that I don't know how to make a new QSettings pointing to some Settings that was made by some version of the same software (so it's the same organizationNames but ApplicationNames differents).
          There might be some other settings or not ... thats why it's shame the class does not allow me to check the other Application names.

          If anyone has a small idea how to do it, it's very welcome.

          1 Reply Last reply
          0
          • E Offline
            E Offline
            evergreen
            wrote on last edited by
            #5

            Thanks Anselmolsm
            I thought and even tested that but it messes with windows registers...

            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