Qsettings : get all applicationname

  • 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.

  • 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.

  • 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?

  • 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.

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

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.