Class: QgsSettingsTreeNode¶
A tree node for the settings tree to help organizing and introspecting the tree.
It is either a root node, a normal node or a named list (to store a group of settings under a dynamic named key). to automatically register a settings entry on its creation when a parent is provided.
See also
See also
Class Hierarchy¶
Subclasses¶
A named list tree node for the settings tree to help organizing and introspecting the tree. |
Methods
Returns the existing child node if it exists at the given key |
|
Returns the existing child settings if it exists at the given key |
|
Returns the children nodes |
|
Returns the children settings |
|
Returns the complete key of the node (including its parents) |
|
Creates a normal tree node It will return the existing child node if it exists at the given key |
|
Creates a named list tree node. |
|
Returns the key of the node (without its parents) |
|
Returns the number of named nodes in the complete key |
|
Returns the parent of the node or None if it does not exists |
|
Registers a child setting |
|
Returns the type of node |
|
Unregisters the child tree node |
|
Unregisters the child setting |
- class qgis.core.QgsSettingsTreeNode[source]¶
Bases:
object
- childNode(self, key: str | None) QgsSettingsTreeNode | None [source]¶
Returns the existing child node if it exists at the given
key
- Parameters:
key (Optional[str])
- Return type:
Optional[QgsSettingsTreeNode]
- childSetting(self, key: str | None) QgsSettingsEntryBase | None [source]¶
Returns the existing child settings if it exists at the given
key
- Parameters:
key (Optional[str])
- Return type:
Optional[QgsSettingsEntryBase]
- childrenNodes(self) List[QgsSettingsTreeNode] ¶
Returns the children nodes
- Return type:
List[QgsSettingsTreeNode]
- childrenSettings(self) List[QgsSettingsEntryBase] ¶
Returns the children settings
- Return type:
List[QgsSettingsEntryBase]
- completeKey(self) str [source]¶
Returns the complete key of the node (including its parents)
- Return type:
str
- createChildNode(self, key: str | None) QgsSettingsTreeNode | None [source]¶
Creates a normal tree node It will return the existing child node if it exists at the given key
- Raises:
QgsSettingsException – if a setting exists with the same key
- Parameters:
key (Optional[str])
- Return type:
Optional[QgsSettingsTreeNode]
- createNamedListNode(self, key: str | None, options: Qgis.SettingsTreeNodeOptions | Qgis.SettingsTreeNodeOption = Qgis.SettingsTreeNodeOptions()) QgsSettingsTreeNamedListNode | None [source]¶
Creates a named list tree node. This is useful to register groups of settings for several named items (for instance credentials for several named services)
- Parameters:
key (Optional[str])
options (Union[Qgis.SettingsTreeNodeOptions, Qgis.SettingsTreeNodeOption] = Qgis.SettingsTreeNodeOptions())
- Return type:
Optional[QgsSettingsTreeNamedListNode]
- namedNodesCount(self) int [source]¶
Returns the number of named nodes in the complete key
- Return type:
int
- parent(self) QgsSettingsTreeNode | None [source]¶
Returns the parent of the node or None if it does not exists
- Return type:
Optional[QgsSettingsTreeNode]
- registerChildSetting(self, setting: QgsSettingsEntryBase | None, key: str | None)[source]¶
Registers a child setting
- Parameters:
setting (Optional[QgsSettingsEntryBase]) – the setting to register
key (Optional[str]) – the key of the setting (not the complete key from its parents)
Note
Ownership of the setting is transferred
Note
The registration is automatically done when calling the setting’s constructor with the parent argument signature
- Raises:
QgsSettingsException – if a setting exists with the same key
- type(self) Qgis.SettingsTreeNodeType [source]¶
Returns the type of node
- Return type:
- unregisterChildNode(self, node: QgsSettingsTreeNode | None)[source]¶
Unregisters the child tree
node
- Parameters:
node (Optional[QgsSettingsTreeNode])
- unregisterChildSetting(self, setting: QgsSettingsEntryBase | None, deleteSettingValues: bool = False, parentsNamedItems: Iterable[str | None] = [])[source]¶
Unregisters the child setting
- Parameters:
setting (Optional[QgsSettingsEntryBase]) – the setting to unregister
deleteSettingValues (bool = False) – if
True
, the values of the settings will also be deletedparentsNamedItems (Iterable[Optional[str]] = []) – the list of named items in the parent named list (if any)