On 05-06-15 16:34, Tom Chadwin wrote:
> OK, so I have found the documentation which says I should use QSettings(),
> which is clear enough, and I can read settings in fine. However, if I want
> my plugin settings to persist transparently (ie the user should not have to
> save the settings explicitly), where in the plugin should I put all my
> QSettings().value("key", "value") statements?

Not sure if it is the best way, but actually whenever the user changes
something (by clicking or inputting something) you can 'save' it to
settings.

As an example:

https://github.com/rduivenvoorde/featuregridcreator/blob/master/FeatureGridCreator/grid_creator.py#L173

I create two helper functions to set and get settings value (and make it
possible to return a default value in case setting is not set).

and all the getter setter's are used when the user clicks (changes)
something in the dialog. So the settings are being constantly in sync
with the user latest choices...

But there are probably other ways too :-)

Regards,

Richard Duivenvoorde

_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to