Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Qsettings : get all applicationname

    General and Desktop
    3
    5
    2866
    Loading More Posts
    • 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
      evergreen last edited by

      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 Reply Quote 0
      • F
        Franzk last edited by

        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 Reply Quote 0
        • A
          anselmolsm last edited by

          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 Reply Quote 0
          • E
            evergreen last edited by

            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 Reply Quote 0
            • E
              evergreen last edited by

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

              1 Reply Last reply Reply Quote 0
              • First post
                Last post