PDA

View Full Version : [qt4.1,win,g++] QSettings does not write settings



jh
31st January 2006, 21:55
hi,

before an application is exited a method is called where the settings should
be written to the registry:


void
fdi_MainWindow::write_settings()
{

QSettings settings;

settings.setValue(fdinsight_settings + "/version", version );
settings.setValue(fdinsight_settings + "/window/posx", x() );
settings.setValue(fdinsight_settings + "/window/posy", y() );
settings.setValue(fdinsight_settings + "/window/width", width() );
settings.setValue(fdinsight_settings + "/window/height", height() );

}

i cannot find the settings in the registry, when the app tries to read
the settings they could not be read as well.

what's wrong?

regards,
jh

jacek
31st January 2006, 22:24
What does QSettings::status() return? What is the value of fdinsight_settings variable?

jh
31st January 2006, 22:52
fdinsight_settings is just a qstring.

status returns:

QSettings::AccessError

how can it be that an access error occurs while trying to
write the registry? did i forget anything?
(btw. the code worked with qt3)

regards,
jh

seneca
31st January 2006, 23:22
Add this behind the QApplication constructor of your main():


QApplication a(argc, argv);
a.setOrganizationName("My Company");
a.setOrganizationDomain("mycompany.com");
a.setApplicationName("My Application");

jh
1st February 2006, 18:17
it works. thanx a lot!

jh