[Client] Saving a list of data in the settings file

Post here if you want to help developing something for FAF.

[Client] Saving a list of data in the settings file

Postby mitttig » 26 Apr 2016, 16:00

I've been trying to save a list of booleans into the settings file but have some trouble with it.
I did change it to a bytearray with the replace but suffered from the same problems.
The only way where I "fixed" it was manually importing QSettings and calling setValue in the code and bypassing the wrapper entirely.

To my understanding:
The settings file saves QVariants in the settings file and try to convert it from or to QMetaType for usage in the code.
The settings class creates a property in the class and overloads the get/set functions in the property to save it into the settingsfile.

Currently it's an List/QStringlist but it has 2 rather irritating problems.
The operator[] doesn't call the setter on the property so settings won't update the file if you don't call settings.set yourself (which is ugly)
When changing the first item of the list the first time it won't update the file (but does change the variable in memory)

This is related to this pull request:
mitttig
 
Posts: 8
Joined: 08 Feb 2016, 20:44
Has liked: 4 times
Been liked: 0 time
FAF User Name: mitttig

Re: [Client] Saving a list of data in the settings file

Postby mitttig » 26 Apr 2016, 16:24

Fixed, thanks to elrna
mitttig
 
Posts: 8
Joined: 08 Feb 2016, 20:44
Has liked: 4 times
Been liked: 0 time
FAF User Name: mitttig


Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest