16#ifndef QGSSETTINGSTREENODE_H
17#define QGSSETTINGSTREENODE_H
26using namespace Qt::StringLiterals;
47class CORE_EXPORT QgsSettingsTreeNode
53 sipType = sipType_QgsSettingsTreeNamedListNode;
54 else if (
dynamic_cast< QgsSettingsTreeNode *
>( sipCpp ) )
55 sipType = sipType_QgsSettingsTreeNode;
65 virtual ~QgsSettingsTreeNode();
106 void unregisterChildSetting(
const QgsSettingsEntryBase *setting,
bool deleteSettingValues =
false,
const QStringList &parentsNamedItems = QStringList() );
124 QgsSettingsTreeNode *
parent()
const {
return mParent;}
127 QString
key()
const {
return mKey;}
136 SIP_PYOBJECT __repr__();
138 const QMetaEnum metaEnum = QMetaEnum::fromType<Qgis::SettingsTreeNodeType>();
140 QString str = u
"<QgsSettingsTreeNode (%1): %2>"_s.arg( metaEnum.valueToKey(
static_cast<int>( sipCpp->type() ) ), sipCpp->key() );
141 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
159 QgsSettingsTreeNode() =
default SIP_FORCE;
161 QgsSettingsTreeNode(
const QgsSettingsTreeNode &other ) =
default SIP_FORCE;
164 void init( QgsSettingsTreeNode *
parent,
const QString &
key );
169 QgsSettingsTreeNode *childNodeAtKey(
const QString &
key );
171 QList<QgsSettingsTreeNode *> mChildrenNodes;
172 QList<const QgsSettingsEntryBase *> mChildrenSettings;
173 QgsSettingsTreeNode *mParent =
nullptr;
176 QString mCompleteKey;
177 int mNamedNodesCount = 0;
199 ~QgsSettingsTreeNamedListNode()
override;
264 QgsSettingsTreeNamedListNode()
SIP_FORCE;
266 QgsSettingsTreeNamedListNode( const QgsSettingsTreeNamedListNode &other ) = delete;
269 QString completeKeyWithNamedItems( const QString &
key, const QStringList &namedItems ) const;
271 Qgis::SettingsTreeNodeOptions mOptions;
273 QString mItemsCompleteKey;
Provides global constants and enumerations for use throughout the application.
SettingsTreeNodeType
Type of tree node.
QFlags< SettingsTreeNodeOption > SettingsTreeNodeOptions
SettingsOrigin
The setting origin describes where a setting is stored.
Represents a settings entry and provides methods for reading and writing settings values.
Custom exception class for settings related exceptions.
A named list tree node for the settings tree to help organizing and introspecting the tree.
const QgsSettingsEntryString * selectedItemSetting() const
Returns the setting used to store the selected item.
void deleteAllItems(const QStringList &parentsNamedItems=QStringList())
Deletes all items from the named list node.
void deleteItem(const QString &item, const QStringList &parentsNamedItems=QStringList())
Deletes a named item from the named list node.
friend class QgsSettingsTreeNode
QString selectedItem(const QStringList &parentsNamedItems=QStringList())
Returns the selected named item from the named list node.
void setSelectedItem(const QString &item, const QStringList &parentsNamedItems=QStringList())
Sets the selected named item from the named list node.
QStringList items(const QStringList &parentsNamedItems=QStringList()) const
Returns the list of items.
A tree node for the settings tree to help organizing and introspecting the tree.
QList< const QgsSettingsEntryBase * > childrenSettings() const
Returns the children settings.
friend class QgsSettingsTree
QList< QgsSettingsTreeNode * > childrenNodes() const
Returns the children nodes.
Qgis::SettingsTreeNodeType type() const
Returns the type of node.
QgsSettingsTreeNode * createChildNode(const QString &key)
Creates a normal tree node It will return the existing child node if it exists at the given key.
Qgis::SettingsTreeNodeType mType
QString completeKey() const
Returns the complete key of the node (including its parents).
int namedNodesCount() const
Returns the number of named nodes in the complete key.
static QgsSettingsTreeNode * createRootNode()
Creates a tree root node.
QString key() const
Returns the key of the node (without its parents).
friend class QgsSettingsTreeNamedListNode
QgsSettingsTreeNode * parent() const
Returns the parent of the node or nullptr if it does not exists.
QgsSettingsTreeNamedListNode * createNamedListNode(const QString &key, const Qgis::SettingsTreeNodeOptions &options=Qgis::SettingsTreeNodeOptions())
Creates a named list tree node.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
#define SIP_KEEPREFERENCE
#define SIP_THROW(name,...)