New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QGIS setting registry follow-up #245
Comments
Hi @3nids. I'm working on wrapping up the 2022 grant programme. How is the progress on this project? Can you give me an estimate for the completion and final report? As you probably know, I'm collecting all final reports and summarizing them so everyone can read up on the results of the programme. |
We are currently working on this, I think I will get things in by 10 days from now. |
@3nids could you please share a link to the final report here? Thank you, Anita |
Here is the report: After some hard thinking, I have finally found a nice way to register settings in a hierarchical and organized way, without too much complexity in the API to actually use the settings. The work can mainly be seen here PR qgis/QGIS#51295 with the proposed approach. The PR is actually a part of the original QEP (mostly the GUI part is missing). I commit to start implementing the GUI part during the HF in NL this spring. The migration of the remaining settings will be done continuously from now on (whenever some code is touched). |
QGIS Enhancement: QGIS setting registry follow-up
Date 2022/02/01
Author/contact/maintainer Denis Rouzaud (@3nids)
Version QGIS 3.26/28
Context
Thanks to the Grant Proposal #124 in 2020, a settings registry has been implemented into QGIS core:
This is available since QGIS 3.20 and allows to statically declare settings and add them in a registry:
Thanks to this foundation which is now in place, we propose now to migrate all the remaining settings and improve the way the user can set the value of the setting.
What will be done
Migration of the remaining settings
QgsSettings
) in any part of the codeUse the introspection in the advanced settings editor
Rather than looping through the keys of
QSettings
, we will use introspection to display all the settings in the advanced settings editor.A dedicated section will be created for plugins settings. It will list settings:
Explicit declaration of sections/prefixes
The sections/prefixes will be statically declared in the registries and reused in the constructors of the settings.
The prefix are used to classify settings in a tree. This is reused in the advanced settings editor to display the settings in a tree.
The advantages:
QgsSettings::Section
goal to organize all the settings in a clear way (the complete key is defined only once)This change will not be in-forced (settings could still be declared with
'/section/sub_section/setting_name'
)The sections will defined in each registry without any constraint on overlapping.
Sub-registries can use the settings prefixes defined in a parent registry.
Settings GUI editors
The idea is to provide a default widget editor for each of the settings type (a color picker for color, a spin box for integers, a combobox for enum, etc.).
These editors will then be used in the advanced settings editor.
These editors will be added:
QgsSettingsEntryString
QgsSettingsEntryStringList
QgsSettingsEntryBool
QgsSettingsEntryInteger
(with min/max)QgsSettingsEntryDouble
QgsSettingsEntryColor
QgsSettingsEntryEnum
*checkable list
QgsSettingsEntryFlags
QgsSettingsEntryVariant
(not used up to now)A Python API will be offered, which will be very useful for plugins (which would replace https://github.com/opengisch/qgis_setting_manager).
Optional additions
Depending on time left or as a follow-up, these could be implemented:
Backwards Compatibility
We provide full compatibility with former settings.
The text was updated successfully, but these errors were encountered: