AbduRasulcpp
AbduRasulcpp

Reputation: 1

How to modify registry settings in Qt?

I decided to make a simple proxy server using Qt/c++. So, the first thing i need to care is to enable 127.0.0.1:8080 to be my proxy server address but i don`t know how to do that in Qt although in delphi it is easy doing it in Windows OS, like this:

var  _reg:TRegIniFile; 
begin  
_reg := TRegIniFile.Create('Software\Microsoft\Windows\CurrentVersion\Internet Settings');  
_reg.WriteString('','ProxyServer', '127.0.0.1:8080'); 
_reg.WriteBool('', 'ProxyEnable', true);  
_reg.Free; 
end;

so, can you please help me how to do this in Qt? Thank you in advance!

Upvotes: 0

Views: 355

Answers (1)

Michael Schm.
Michael Schm.

Reputation: 2534

You can use QSettings to modify the registry entries.

QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", Setting::NativeFormat);
settings.setValue("ProxyServer", "127.0.0.1:8080");
settings.setValue("ProxyEnable", 1);

Upvotes: 1

Related Questions