Plugin options and QGIS3.ini

In the spirit of learning in the open:

All the docs say is “It is recommended to give some structure to naming of keys.”

The [PythonPlugins] section uses the plugins’ directory names and shows if a plugin is activated or not (true/false).

Plugins can store their options anywhere. No really. Anywhere! You will find some in their own sections, e. g.:

  • Qgis2threejs (directory “Qgis2threejs“) uses a [Qgis2threejs] section, named the same as its directory
  • First Aid (firstaid) uses a [FirstAid] section, using different case than its directory, and another section [firstaid] for other options
  • Plugin Builder 3 (pluginbuilder3) uses a [PluginBuilder] section, named differently than its directory
  • QGIS GML Application Schema Toolbox (gml_application_schema_toolbox) stores options in [QGIS%20GML%20Application%20Schema%20Toolbox] (needlessly) using URL encoding
  • RĂ€umlicher Filter (spatial_filter) uses two sections: [SpatialFilter] and [SpatialFilterSymbol] (sorry, we didn’t know better…)
  • There is a [Plugins] and a [plugins] section. I found some plugins storing some options in the [plugins] section, e.g. First Aid storing some firstaid\debugger-geometry=... there. [Plugins] seems to be used by core plugins. [plugins] stores e.g. if QGIS should automatically check for new ones (although that is also might be tracked in the [plugin-manager] section, no idea which option comes from an older QGIS version maybe).

Some things can be stored elsewhere, I am not sure who does it, maybe some objects do this automatically? E.g. in the [QgsCollapsibleGroupBox] section you might find the states of all(?) QgsCollapsibleGroupBox objects such as gml_application_schema_toolbox\gmlas_bbox_group\collapsed=false concerning a plugin’s widget. Or in [Windows] you might find FirstAidDebugDialog\geometry=....

Plugins might alter any other options of course. There is no way of knowing what plugin touched what (great power and mostly good :) ).

Uninstalling a plugin does not remove the sections from the INI. The plugin itself does not have a chance to clean that up and QGIS has no way of knowing what to remove. (Of course it might be wanted to keep settings around, but it would be nice to be able to really prune something.)

tl;dr: There is no standard, no rules nor best practices for QGIS plugins to store their options.

PS: This post might get updated as I learn. Corrections and improvements are highly appreciated.

PPS: Excuse the big bold highlighting. That’s for me.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.