[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:

<goog_1212792088>
https://github.com/qgis/QGIS/blob/master/src/gui/qgsexpressionbuilderdialog.cpp#L26

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

<goog_1212792089>
https://github.com/qgis/QGIS/commit/57dc9deb06a8f4474429b2956008188292588a1b#diff-b4d61d74d8a5b5319106d746b54d378bL21

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.

Regards,
Nathan
-------------- 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