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 - checking the registry hive
Forum Updated to NodeBB v4.3 + New Features

QSettings - checking the registry hive

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 792 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    maniek1310
    wrote on last edited by
    #1

    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;
    }
    

    @

    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