16#ifndef QGSSETTINGSTREENODE_H
17#define QGSSETTINGSTREENODE_H
44class CORE_EXPORT QgsSettingsTreeNode
50 sipType = sipType_QgsSettingsTreeNamedListNode;
51 else if (
dynamic_cast< QgsSettingsTreeNode *
>( sipCpp ) )
52 sipType = sipType_QgsSettingsTreeNode;
62 virtual ~QgsSettingsTreeNode();
103 void unregisterChildSetting(
const QgsSettingsEntryBase *setting,
bool deleteSettingValues =
false,
const QStringList &parentsNamedItems = QStringList() );
121 QgsSettingsTreeNode *
parent()
const {
return mParent;}
124 QString
key()
const {
return mKey;}
133 SIP_PYOBJECT __repr__();
135 const QMetaEnum metaEnum = QMetaEnum::fromType<Qgis::SettingsTreeNodeType>();
137 QString str = QStringLiteral(
"<QgsSettingsTreeNode (%1): %2>" ).arg( metaEnum.valueToKey(
static_cast<int>( sipCpp->type() ) ), sipCpp->key() );
138 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
156 QgsSettingsTreeNode() =
default SIP_FORCE;
158 QgsSettingsTreeNode(
const QgsSettingsTreeNode &other ) =
default SIP_FORCE;
161 void init( QgsSettingsTreeNode *
parent,
const QString &
key );
166 QgsSettingsTreeNode *childNodeAtKey(
const QString &
key );
168 QList<QgsSettingsTreeNode *> mChildrenNodes;
169 QList<const QgsSettingsEntryBase *> mChildrenSettings;
170 QgsSettingsTreeNode *mParent =
nullptr;
173 QString mCompleteKey;
174 int mNamedNodesCount = 0;
196 ~QgsSettingsTreeNamedListNode()
override;
261 QgsSettingsTreeNamedListNode()
SIP_FORCE;
263 QgsSettingsTreeNamedListNode( const QgsSettingsTreeNamedListNode &other ) = delete;
266 QString completeKeyWithNamedItems( const QString &
key, const QStringList &namedItems ) const;
268 Qgis::SettingsTreeNodeOptions mOptions;
270 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,...)