Thanks, Richard. That would work perfectly, but my UI is mostly QTreeWidgetItem
elements. Apparently, those don't emit valueChanged signals, so I can't use
your code (unless I've got that wrong). I therefore either have to find some
other signal I can hook into, or save the settings at some other point. Any
ideas?
-------- Original message --------
From: "Richard Duivenvoorde [via OSGeo.org]"
<[email protected]>
Date: 05/06/2015 16:08 (GMT+00:00)
To: Tom Chadwin <[email protected]>
Subject: Re: Persist plugin GUI dialog settings
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
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
________________________________
If you reply to this email, your message will be added to the discussion below:
http://osgeo-org.1560.x6.nabble.com/Persist-plugin-GUI-dialog-settings-tp5160325p5209443.html
To unsubscribe from Persist plugin GUI dialog settings, click
here<http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5160325&code=dG9tLmNoYWR3aW5Abm5wYS5vcmcudWt8NTE2MDMyNXwxNDg2MTk5Mjcx>.
NAML<http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
Tom Chadwin, ICT Manager
Telephone: 01434 611530 Mob:
Web:
www.northumberlandnationalpark.org.uk<http://www.northumberlandnationalpark.org.uk/>
IMPORTANT NOTICE - Disclaimer - This communication is from Northumberland
National Park Authority (NNPA).The Authority’s head office and principal place
of business is Eastburn, South Park, Hexham, Northumberland, NE46 1BS, United
Kingdom. If you are not the intended recipient(s) please note that any form of
disclosure, distribution, copying or use of this communication or the
information in it or in any attachments is strictly prohibited and may be
unlawful. If you have received this communication in error, please delete the
email and destroy any copies of it. Any views or opinions presented are solely
those of the author and do not necessarily represent those of NNPA.Contractors
or potential contractors are reminded that a formal Order or Contract is needed
for NNPA to be bound by any offer or acceptance of terms for the supply of
goods or services Although this email and any attachments are believed to be
free of any virus or other defects which might affect any computer or IT system
into which they are received, no responsibility is accepted by the NNPA for any
loss or damage arising in any way from the receipt or use thereof. Computer
systems of this Authority may be monitored and communications carried out on
them recorded, to secure the effective operation of the system and for other
lawful purpose.
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Persist-plugin-GUI-dialog-settings-tp5160325p5209522.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com._______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer