You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, May 9th 2012, 9:37pm

Read windows registry key with Qsettings without creating one

Hello,

in my program I've got the following lines:

Source code

1
2
QSettings gnuPGsettings("HKEY_CURRENT_USER\\Software\\GNU\\GNUPG", QSettings::NativeFormat);
gnuPGHome = gnuPGsettings.value("HomeDir").toString();


The program should be protable, so no registry key should be created. Problem is, that with the first line the key is automatically created, if it doesn't already exist. So how can I prevent the creation of this key?

I already searched a lot without any helpful result.

Many thanks in advance for any help.

2

Wednesday, May 9th 2012, 10:04pm

HKEY_CURRENT_USER\\Software will always(?) exist so you can start from that settings point and check for child group existing for GNU, then check again for GNUPG ...

similar to here http://stackoverflow.com/questions/84846…-with-qsettings
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.