What i'm trying to do is to check if a registry key (NOT VALUE, KEY) exists in the registry. I can't find any way to check that.
Idea?
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With