-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Settings registry (QEP 124) part two settings introspection #42860
Conversation
@domi4484 nice work! Just a question how is the section handled? Is it set in the QgsSettingsEntry ? |
@elpaso Thank you for the suggestions! Yes the section is passed to the QgsSettingsEntry constructor. It means settings in the core registry could have other sections than core. When getting/setting values internally QgsSettings is used and the section is passed one to one. |
} | ||
|
||
if ( !hasDynamicKey() ) | ||
return completeKeyToCheck == prefixedSettingsKey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably use QString::compare
method for a string comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pblottiere Thank you for the review! Why is QString::compare
preferable over the == operator in this case? Compare return an integer with more information (greater/smaller/equal) and all i want is to know if the string are equal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case, it doesn't seem to be significant
https://forum.qt.io/topic/52155/compare-2-qstring-use-or-qstring-compare
Co-authored-by: Paul Blottiere <blottiere.paul@gmail.com>
/** | ||
* Add a child \a settingsRegistry to the register. | ||
*/ | ||
void addChildSettingsRegistry( const QgsSettingsRegistry *settingsRegistry ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addChildSettingsRegistry => integrateRegistry or addRegistry or appendRegistry ?
As of Enhancement proposal #124 and as followup to merged pr #42597 this pull request introduces a new class QgsSettingsRegistry.
QgsSettingsRegistry is used for settings introspection and collects a list of QgsSettingsEntries and a list of child sub QgsSettingsRegistries
Sub modules and plugins can have their own settings registry and register it to the main one (QgsSettingsRegistryCore).
Usage example from plugin:
QgsSettingsRegistryCore can be used as single entry point for example from the advanced settings editor. If settings are registered the description is shown like in the following screenshot. In the future more information could be used to improve the editor like default values, value range and so on.