I tried
QSettings mSettings;
mSettings.setValue("HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/USBTOR/Start", 4);
This didn't work.
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 it states:
The QSettings class provides persistent platform-independent application settings....QSettings is an abstraction around these technologies
If you look at the documentation for QSettings 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.
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);