[PyKDE] QSettings

Fabian Steiner lists at fabis-site.net
Sat Mar 11 15:55:25 GMT 2006


Hello!

I am using QSettings to save my application's preferences on disk. 
Unfortunately, it doesn't work as I would like it to do.

My Config class looks like this: http://fabis-site.net/Config.py.txt

In my current application I have got one MainWindow and several Dialogs 
which need special config data to work properly. Therefore I always 
create a new instance of this Config class in the constructors of the 
Dialogs, so that I am able to access methods like getDatabaseConfig(). 
 From time to time I do have to change properties, that's why I added 
additional methods like setDatabaseConfig().
However, when a Dialog (where the changes where made) _and_ the 
MainWindow are closed, my wscrc file isn't changed, since the closeEvent 
of MainWindow, calls savePreferences() of its Config class instance 
which of course doesn't know that special properties were changed and so 
it overwrites the changes made in the Dialog.

How can I solve this problem? I thought of passing the current Config 
class instance to one of the Dialog constructor's arguments. Is there 
any better solution?

Cheers,
Fabian




More information about the PyQt mailing list