QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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.
 
QList< QgsSettingsTreeNode * > childrenNodes () const
 Returns the children nodes.
 
QList< const QgsSettingsEntryBase * > childrenSettings () const
 Returns the children settings.
 
const QgsSettingsEntryBasechildSetting (const QString &key) const
 Returns the existing child settings if it exists at the given key.
 
QString completeKey () const
 Returns the complete key of the node (including its parents)
 
QgsSettingsTreeNodecreateChildNode (const QString &key)
 Creates a normal tree node It will return the existing child node if it exists at the given key.
 
QgsSettingsTreeNamedListNodecreateNamedListNode (const QString &key, const Qgis::SettingsTreeNodeOptions &options=Qgis::SettingsTreeNodeOptions())
 Creates a named list tree node.
 
QString key () const
 Returns the key of the node (without its parents)
 
int namedNodesCount () const
 Returns the number of named nodes in the complete key.
 
QgsSettingsTreeNodeparent () const
 Returns the parent of the node or nullptr if it does not exists.
 
void registerChildSetting (const QgsSettingsEntryBase *setting, const QString &key)
 Registers a child setting.
 
Qgis::SettingsTreeNodeType type () const
 Returns the type of node.
 
void unregisterChildNode (QgsSettingsTreeNode *node)
 Unregisters the child tree node.
 
void unregisterChildSetting (const QgsSettingsEntryBase *setting, bool deleteSettingValues=false, const QStringList &parentsNamedItems=QStringList())
 Unregisters the child setting.
 

Static Public Member Functions

static QgsSettingsTreeNodecreateRootNode ()
 Creates a tree root node.
 

Protected Member Functions

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

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 44 of file qgssettingstreenode.h.

Constructor & Destructor Documentation

◆ ~QgsSettingsTreeNode()

QgsSettingsTreeNode::~QgsSettingsTreeNode ( )
virtual

Definition at line 25 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 88 of file qgssettingstreenode.cpp.

◆ childrenNodes()

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

Returns the children nodes.

Definition at line 109 of file qgssettingstreenode.h.

◆ childrenSettings()

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

Returns the children settings.

Definition at line 115 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 99 of file qgssettingstreenode.cpp.

◆ completeKey()

QString QgsSettingsTreeNode::completeKey ( ) const
inline

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

Definition at line 127 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 51 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 66 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 42 of file qgssettingstreenode.cpp.

◆ key()

QString QgsSettingsTreeNode::key ( ) const
inline

Returns the key of the node (without its parents)

Definition at line 124 of file qgssettingstreenode.h.

◆ namedNodesCount()

int QgsSettingsTreeNode::namedNodesCount ( ) const
inline

Returns the number of named nodes in the complete key.

Definition at line 130 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 121 of file qgssettingstreenode.h.

◆ registerChildNode()

void QgsSettingsTreeNode::registerChildNode ( QgsSettingsTreeNode node)
protected

Registers a child nodes.

Definition at line 122 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 111 of file qgssettingstreenode.cpp.

◆ type()

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

Returns the type of node.

Definition at line 85 of file qgssettingstreenode.h.

◆ unregisterChildNode()

void QgsSettingsTreeNode::unregisterChildNode ( QgsSettingsTreeNode node)

Unregisters the child tree node.

Definition at line 135 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 127 of file qgssettingstreenode.cpp.

Friends And Related Symbol Documentation

◆ QgsSettingsTree

friend class QgsSettingsTree
friend

Definition at line 161 of file qgssettingstreenode.h.

◆ QgsSettingsTreeNamedListNode

friend class QgsSettingsTreeNamedListNode
friend

Definition at line 162 of file qgssettingstreenode.h.

Member Data Documentation

◆ mType

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

Definition at line 146 of file qgssettingstreenode.h.


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