QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
QgsSettingsTreeNode Class Reference

QgsSettingsTreeNode is a tree node for the settings tree to help organizing and introspecting the tree. More...

#include <qgssettingstreenode.h>

Inheritance diagram for QgsSettingsTreeNode:
Inheritance graph
[legend]

Public Member Functions

virtual ~QgsSettingsTreeNode ()
 
QgsSettingsTreeNodechildNode (const QString &key) const
 Returns the existing child node if it exists at the given key. More...
 
QList< QgsSettingsTreeNode * > childrenNodes () const
 Returns the children nodes. More...
 
QList< const QgsSettingsEntryBase * > childrenSettings () const
 Returns the children settings. More...
 
const QgsSettingsEntryBasechildSetting (const QString &key) const
 Returns the existing child settings if it exists at the given key. More...
 
QString completeKey () const
 Returns the complete key of the node (including its parents) More...
 
QgsSettingsTreeNodecreateChildNode (const QString &key)
 Creates a normal tree node It will return the existing child node if it exists at the given key. More...
 
QgsSettingsTreeNamedListNodecreateNamedListNode (const QString &key, const Qgis::SettingsTreeNodeOptions &options=Qgis::SettingsTreeNodeOptions())
 Creates a named list tree node. More...
 
QString key () const
 Returns the key of the node (without its parents) More...
 
int namedNodesCount () const
 Returns the number of named nodes in the complete key. More...
 
QgsSettingsTreeNodeparent () const
 Returns the parent of the node or nullptr if it does not exists. More...
 
void registerChildSetting (const QgsSettingsEntryBase *setting, const QString &key)
 Registers a child setting. More...
 
Qgis::SettingsTreeNodeType type () const
 Returns the type of node. More...
 
void unregisterChildNode (QgsSettingsTreeNode *node)
 Unregisters the child tree node. More...
 
void unregisterChildSetting (const QgsSettingsEntryBase *setting, bool deleteSettingValues=false, const QStringList &parentsNamedItems=QStringList())
 Unregisters the child setting. More...
 

Static Public Member Functions

static QgsSettingsTreeNodecreateRootNode ()
 Creates a tree root node. More...
 

Protected Member Functions

void registerChildNode (QgsSettingsTreeNode *node)
 Registers a child nodes. More...
 

Protected Attributes

Qgis::SettingsTreeNodeType mType = Qgis::SettingsTreeNodeType::Root
 

Friends

class QgsSettingsTree
 
class QgsSettingsTreeNamedListNode
 

Detailed Description

QgsSettingsTreeNode is 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
QgsSettingsTree
QgsSettingsEntryBase
Since
QGIS 3.30

Definition at line 43 of file qgssettingstreenode.h.

Constructor & Destructor Documentation

◆ ~QgsSettingsTreeNode()

QgsSettingsTreeNode::~QgsSettingsTreeNode ( )
virtual

Definition at line 24 of file qgssettingstreenode.cpp.

Member Function Documentation

◆ childNode()

QgsSettingsTreeNode * QgsSettingsTreeNode::childNode ( const QString &  key) const

Returns the existing child node if it exists at the given key.

Definition at line 79 of file qgssettingstreenode.cpp.

◆ childrenNodes()

QList< QgsSettingsTreeNode * > QgsSettingsTreeNode::childrenNodes ( ) const
inline

Returns the children nodes.

Definition at line 108 of file qgssettingstreenode.h.

◆ childrenSettings()

QList< const QgsSettingsEntryBase * > QgsSettingsTreeNode::childrenSettings ( ) const
inline

Returns the children settings.

Definition at line 114 of file qgssettingstreenode.h.

◆ childSetting()

const QgsSettingsEntryBase * QgsSettingsTreeNode::childSetting ( const QString &  key) const

Returns the existing child settings if it exists at the given key.

Definition at line 90 of file qgssettingstreenode.cpp.

◆ completeKey()

QString QgsSettingsTreeNode::completeKey ( ) const
inline

Returns the complete key of the node (including its parents)

Definition at line 126 of file qgssettingstreenode.h.

◆ createChildNode()

QgsSettingsTreeNode * QgsSettingsTreeNode::createChildNode ( const QString &  key)

Creates a normal tree node It will return the existing child node if it exists at the given key.

Exceptions
QgsSettingsExceptionif a setting exists with the same key

Definition at line 42 of file qgssettingstreenode.cpp.

◆ createNamedListNode()

QgsSettingsTreeNamedListNode * QgsSettingsTreeNode::createNamedListNode ( const QString &  key,
const Qgis::SettingsTreeNodeOptions options = Qgis::SettingsTreeNodeOptions() 
)

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)

Definition at line 57 of file qgssettingstreenode.cpp.

◆ createRootNode()

QgsSettingsTreeNode * QgsSettingsTreeNode::createRootNode ( )
static

Creates a tree root node.

Note
This is not available in Python bindings. Use QgsSettingsTree.createPluginTreeNode instead.

Definition at line 33 of file qgssettingstreenode.cpp.

◆ key()

QString QgsSettingsTreeNode::key ( ) const
inline

Returns the key of the node (without its parents)

Definition at line 123 of file qgssettingstreenode.h.

◆ namedNodesCount()

int QgsSettingsTreeNode::namedNodesCount ( ) const
inline

Returns the number of named nodes in the complete key.

Definition at line 129 of file qgssettingstreenode.h.

◆ parent()

QgsSettingsTreeNode * QgsSettingsTreeNode::parent ( ) const
inline

Returns the parent of the node or nullptr if it does not exists.

Definition at line 120 of file qgssettingstreenode.h.

◆ registerChildNode()

void QgsSettingsTreeNode::registerChildNode ( QgsSettingsTreeNode node)
protected

Registers a child nodes.

Definition at line 113 of file qgssettingstreenode.cpp.

◆ registerChildSetting()

void QgsSettingsTreeNode::registerChildSetting ( const QgsSettingsEntryBase setting,
const QString &  key 
)

Registers a child setting.

Parameters
settingthe setting to register
keythe key of the setting (not the complete key from its parents)
Note
Ownership of the setting is transferred
The registration is automatically done when calling the setting's constructor with the parent argument signature
Exceptions
QgsSettingsExceptionif a setting exists with the same key

Definition at line 102 of file qgssettingstreenode.cpp.

◆ type()

Qgis::SettingsTreeNodeType QgsSettingsTreeNode::type ( ) const
inline

Returns the type of node.

Definition at line 84 of file qgssettingstreenode.h.

◆ unregisterChildNode()

void QgsSettingsTreeNode::unregisterChildNode ( QgsSettingsTreeNode node)

Unregisters the child tree node.

Definition at line 126 of file qgssettingstreenode.cpp.

◆ unregisterChildSetting()

void QgsSettingsTreeNode::unregisterChildSetting ( const QgsSettingsEntryBase setting,
bool  deleteSettingValues = false,
const QStringList &  parentsNamedItems = QStringList() 
)

Unregisters the child setting.

Parameters
settingthe setting to unregister
deleteSettingValuesif true, the values of the settings will also be deleted
parentsNamedItemsthe list of named items in the parent named list (if any)

Definition at line 118 of file qgssettingstreenode.cpp.

Friends And Related Function Documentation

◆ QgsSettingsTree

friend class QgsSettingsTree
friend

Definition at line 160 of file qgssettingstreenode.h.

◆ QgsSettingsTreeNamedListNode

friend class QgsSettingsTreeNamedListNode
friend

Definition at line 161 of file qgssettingstreenode.h.

Member Data Documentation

◆ mType

Qgis::SettingsTreeNodeType QgsSettingsTreeNode::mType = Qgis::SettingsTreeNodeType::Root
protected

Definition at line 145 of file qgssettingstreenode.h.


The documentation for this class was generated from the following files: