16#ifndef QGSSETTINGSTREENODE_H
17#define QGSSETTINGSTREENODE_H
26using namespace Qt::StringLiterals;
47class CORE_EXPORT QgsSettingsTreeNode
52 sipType = sipType_QgsSettingsTreeNamedListNode;
53 else if (
dynamic_cast< QgsSettingsTreeNode *
>( sipCpp ) )
54 sipType = sipType_QgsSettingsTreeNode;
66 virtual ~QgsSettingsTreeNode();
108 void unregisterChildSetting(
const QgsSettingsEntryBase *setting,
bool deleteSettingValues =
false,
const QStringList &parentsNamedItems = QStringList() );
114 QList<QgsSettingsTreeNode *>
childrenNodes()
const {
return mChildrenNodes; }
126 QgsSettingsTreeNode *
parent()
const {
return mParent; }
129 QString
key()
const {
return mKey; }
139 SIP_PYOBJECT __repr__();
141 const QMetaEnum metaEnum = QMetaEnum::fromType<Qgis::SettingsTreeNodeType>();
143 QString str = u
"<QgsSettingsTreeNode (%1): %2>"_s.arg( metaEnum.valueToKey(
static_cast<int>( sipCpp->type() ) ), sipCpp->key() );
144 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
164 QgsSettingsTreeNode() =
default SIP_FORCE;
166 QgsSettingsTreeNode(
const QgsSettingsTreeNode &other ) =
default SIP_FORCE;
169 void init( QgsSettingsTreeNode *
parent,
const QString &
key );
174 QgsSettingsTreeNode *childNodeAtKey(
const QString &
key );
176 QList<QgsSettingsTreeNode *> mChildrenNodes;
177 QList<const QgsSettingsEntryBase *> mChildrenSettings;
178 QgsSettingsTreeNode *mParent =
nullptr;
181 QString mCompleteKey;
182 int mNamedNodesCount = 0;
203 ~QgsSettingsTreeNamedListNode()
override;
268 QgsSettingsTreeNamedListNode()
SIP_FORCE;
270 QgsSettingsTreeNamedListNode( const QgsSettingsTreeNamedListNode &other ) = delete;
273 QString completeKeyWithNamedItems( const QString &
key, const QStringList &namedItems ) const;
275 Qgis::SettingsTreeNodeOptions mOptions;
277 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,...)