Reputation: 85
I tried
QSettings mSettings;
mSettings.setValue("HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/USBTOR/Start", 4);
This didn't work.
Upvotes: 3
Views: 6487
Reputation: 27611
As Qt is a multi-platform SDK, it is designed to hide implementation details such as where in the registry on Windows a settings is being stored. As stated in the QSettings class documentation:
The QSettings class provides persistent platform-independent application settings....QSettings is an abstraction around these technologies
If you look at the documentation for QSettings member functions there is no available constructor or function to set a specific registry key; only Windows supports the registry and other platforms use different mechanisms.
If you're trying to save settings for an application, don't worry about where or how they are stored. However, if you want to change values directly in the registry, I suggest using functions from the Windows SDK, not QSettings.
Upvotes: 3
Reputation: 353
Initialize QSettings
with registry path (Make sure to use backslash for registry path)
QSettings settings("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBTOR", QSettings::NativeFormat);
Set Value
settings.setValue("Start", 4);
Upvotes: 10