QSettings - checking the registry hive



  • Hi, using QSettings library, I wrote two functions, viewing and removing the registry keys. Only now I have a problem because I do not know how to modify these functions so that you can remove and check whether there is a branch. example:

    We have a branch "HKEY_CLASSES_ROOT\Directory\background\shell\Opróźnij kosz" and now I want to check if the branch "Opróźnij kosz" exists or not, if there is to this branch has been removed.

    Function :
    @ int Config_os::sprawdz_klucz(QString gdzie, QString key, QString val, QString type)
    {
    QSettings reg(gdzie, QSettings::NativeFormat);
    QString war;

        if(type == "int")
        {
            war = QString::number(reg.value(key).toInt());
        }else if(type == "double")
        {
            war = QString::number(reg.value(key).toDouble());
        }else if(type == "string")
        {
            war = QString(reg.value(key).toString());
        }
     
        if(war == val)
        {
            return 2;
        }else{
            return 4;
        }
     
        return 0;
    }
     
    int Config_os::usun_klucz(QString gdzie, QString key)
    {
        QSettings reg(gdzie, QSettings::NativeFormat);
        QString war;
     
        reg.remove(key);
     
        if(reg.status() == QSettings::NoError)
            return 2;
        else
            return 4;
    }
    

    @


Log in to reply
 

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