Check if a value registry exists with QSettings
Using QSettings you can open the key's parent and retrieve the list of its keys. Use the function childGroups()
to get the list of keys. It seems that "groups" in qt are keys in Windows registry.
This is the only way I found to check whether a key exists. In this code I look for the key "SearchedKey".
QSettings settings(
"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths",
QSettings::NativeFormat
);
if (settings.childGroups().contains("SearchedKey", Qt::CaseInsensitive))
std::cout << "Key exists" << std::endl;
else
std::cout << "Key doesn't exist" << std::endl;