[QGIS-Developer] New API - Easier restore of dialog positions.

Nathan Woodrow madmanwoo at gmail.com
Sun Dec 17 18:10:00 PST 2017

Hey all,

Just thought I would make everyone aware of a quick time saver for
restoring dialog/widget positions added in master.  This is mainly to
remove the pain of having to do restoreGeometry()/saveGeometry() in every
widget and remembering the naming we use for settings keys.  It's also
about fixing consistency inside the application so every dialog remembers
their state correctly.

The new API is:

  QgsGui::instance()->enableAutoGeometryRestore( this );

This should go just after   setupUi( this );

Here is an example:


You can then remove any calls to restoreGeometry() and saveGeometry() in
your widget. Diff of an example:


Unless there is a good reason not, all new widgets should be using this
code when you write them. I would like to ask if people can start to port
existing widgets if they are already editing that code.  I will be doing a
bulk update when I can but I suspect I will miss some and group effort is
better in case I run out of time.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171218/a75034b0/attachment.html>

More information about the QGIS-Developer mailing list