mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-17 00:09:36 -04:00
This adds a mechanism where flushes of QgsSettings to the underlying ini storage file can be temporarily suspended. It is intended for code paths where many settings entries are consecutively read/written, to avoid the very expensive cost of constructing and destructing multiple QgsSettings objects for each in turn. When QgsSettings::holdFlush() is called, then a temporary thread local QgsSettings object will be created and ALL access to settings entries will use this same object (preventing flushing of it to ini files). An accompanying QgsSettings::releaseFlush() call MUST be made from the same thread to destroy the thread local QgsSettings, flush it to disk, and resume normal operation. This helps avoid the VERY costly backward migration of settings, and cuts the run time for qgis_process commands like `qgis_process list` by at least half (and considerably more in common setups).
283 lines
9.0 KiB
Plaintext
283 lines
9.0 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/settings/qgssettingstreenode.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
class QgsSettingsTreeNode
|
|
{
|
|
%Docstring(signature="appended")
|
|
:py:class:`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.
|
|
|
|
.. seealso:: :py:class:`QgsSettingsTree`
|
|
|
|
.. seealso:: :py:class:`QgsSettingsEntryBase`
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgssettingstreenode.h"
|
|
%End
|
|
%ConvertToSubClassCode
|
|
if ( dynamic_cast< QgsSettingsTreeNamedListNode * >( sipCpp ) )
|
|
sipType = sipType_QgsSettingsTreeNamedListNode;
|
|
else if ( dynamic_cast< QgsSettingsTreeNode * >( sipCpp ) )
|
|
sipType = sipType_QgsSettingsTreeNode;
|
|
else
|
|
sipType = NULL;
|
|
%End
|
|
public:
|
|
static const QMetaObject staticMetaObject;
|
|
|
|
public:
|
|
|
|
virtual ~QgsSettingsTreeNode();
|
|
|
|
|
|
QgsSettingsTreeNode *createChildNode( const QString &key ) throw( QgsSettingsException ) /KeepReference/;
|
|
%Docstring
|
|
Creates a normal tree node
|
|
It will return the existing child node if it exists at the given key
|
|
|
|
:raises QgsSettingsException: if a setting exists with the same key
|
|
%End
|
|
|
|
QgsSettingsTreeNamedListNode *createNamedListNode( const QString &key, const Qgis::SettingsTreeNodeOptions &options = Qgis::SettingsTreeNodeOptions() ) throw( QgsSettingsException ) /KeepReference/;
|
|
%Docstring
|
|
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)
|
|
%End
|
|
|
|
|
|
Qgis::SettingsTreeNodeType type() const;
|
|
%Docstring
|
|
Returns the type of node
|
|
%End
|
|
|
|
void registerChildSetting( const QgsSettingsEntryBase *setting, const QString &key ) throw( QgsSettingsException );
|
|
%Docstring
|
|
Registers a child setting
|
|
|
|
:param setting: the setting to register
|
|
:param key: the key of the setting (not the complete key from its parents)
|
|
|
|
.. note::
|
|
|
|
Ownership of the setting is transferred
|
|
|
|
.. note::
|
|
|
|
The registration is automatically done when calling the setting's constructor with the parent argument signature
|
|
|
|
:raises QgsSettingsException: if a setting exists with the same key
|
|
%End
|
|
|
|
void unregisterChildSetting( const QgsSettingsEntryBase *setting, bool deleteSettingValues = false, const QStringList &parentsNamedItems = QStringList() );
|
|
%Docstring
|
|
Unregisters the child setting
|
|
|
|
:param setting: the setting to unregister
|
|
:param deleteSettingValues: if ``True``, the values of the settings will also be deleted
|
|
:param parentsNamedItems: the list of named items in the parent named list (if any)
|
|
%End
|
|
|
|
void unregisterChildNode( QgsSettingsTreeNode *node );
|
|
%Docstring
|
|
Unregisters the child tree ``node``
|
|
%End
|
|
|
|
QList<QgsSettingsTreeNode *> childrenNodes() const;
|
|
%Docstring
|
|
Returns the children nodes
|
|
%End
|
|
|
|
QgsSettingsTreeNode *childNode( const QString &key ) const;
|
|
%Docstring
|
|
Returns the existing child node if it exists at the given ``key``
|
|
%End
|
|
|
|
QList<const QgsSettingsEntryBase *> childrenSettings() const;
|
|
%Docstring
|
|
Returns the children settings
|
|
%End
|
|
|
|
const QgsSettingsEntryBase *childSetting( const QString &key ) const;
|
|
%Docstring
|
|
Returns the existing child settings if it exists at the given ``key``
|
|
%End
|
|
|
|
QgsSettingsTreeNode *parent() const;
|
|
%Docstring
|
|
Returns the parent of the node or None if it does not exists
|
|
%End
|
|
|
|
QString key() const;
|
|
%Docstring
|
|
Returns the key of the node (without its parents)
|
|
%End
|
|
|
|
QString completeKey() const;
|
|
%Docstring
|
|
Returns the complete key of the node (including its parents)
|
|
%End
|
|
|
|
int namedNodesCount() const;
|
|
%Docstring
|
|
Returns the number of named nodes in the complete key
|
|
%End
|
|
|
|
SIP_PYOBJECT __repr__();
|
|
%MethodCode
|
|
const QMetaEnum metaEnum = QMetaEnum::fromType<Qgis::SettingsTreeNodeType>();
|
|
|
|
QString str = QStringLiteral( "<QgsSettingsTreeNode (%1): %2>" ).arg( metaEnum.valueToKey( static_cast<int>( sipCpp->type() ) ), sipCpp->key() );
|
|
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
|
%End
|
|
|
|
protected:
|
|
void registerChildNode( QgsSettingsTreeNode *node );
|
|
%Docstring
|
|
Registers a child nodes
|
|
%End
|
|
|
|
|
|
private:
|
|
QgsSettingsTreeNode();
|
|
%Docstring
|
|
|
|
.. note::
|
|
|
|
This is not available in Python bindings. Use method createNode on an existing tree node.
|
|
|
|
.. seealso:: :py:func:`QgsSettingsTree.createPluginTreeNode`
|
|
%End
|
|
QgsSettingsTreeNode( const QgsSettingsTreeNode &other );
|
|
};
|
|
|
|
|
|
|
|
class QgsSettingsTreeNamedListNode : QgsSettingsTreeNode
|
|
{
|
|
%Docstring(signature="appended")
|
|
:py:class:`QgsSettingsTreeNamedListNode` is a named list tree node for the settings tree
|
|
to help organizing and introspecting the tree.
|
|
the named list node is used to store a group of settings under a dynamically named key.
|
|
|
|
.. seealso:: :py:class:`QgsSettingsTree`
|
|
|
|
.. seealso:: :py:class:`QgsSettingsTreeNode`
|
|
|
|
.. seealso:: :py:class:`QgsSettingsEntryBase`
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgssettingstreenode.h"
|
|
%End
|
|
public:
|
|
virtual ~QgsSettingsTreeNamedListNode();
|
|
|
|
QStringList items( const QStringList &parentsNamedItems = QStringList() ) const throw( QgsSettingsException );
|
|
%Docstring
|
|
Returns the list of items
|
|
|
|
:param parentsNamedItems: the list of named items in the parent named list (if any)
|
|
|
|
:raises QgsSettingsException: if the number of given parent named items doesn't match the complete key definition
|
|
%End
|
|
|
|
QStringList items( Qgis::SettingsOrigin origin, const QStringList &parentsNamedItems = QStringList() ) const throw( QgsSettingsException );
|
|
%Docstring
|
|
Returns the list of items
|
|
|
|
:param origin: can be used to restrict the origin of the setting (local or global)
|
|
:param parentsNamedItems: the list of named items in the parent named list (if any)
|
|
|
|
:raises QgsSettingsException: if the number of given parent named items doesn't match the complete key definition
|
|
%End
|
|
|
|
|
|
void setSelectedItem( const QString &item, const QStringList &parentsNamedItems = QStringList() ) throw( QgsSettingsException );
|
|
%Docstring
|
|
Sets the selected named item from the named list node
|
|
|
|
:param item: the item to set as selected
|
|
:param parentsNamedItems: the list of named items in the parent named list (if any)
|
|
|
|
:raises QgsSettingsException: if the number of given parent named items doesn't match the complete key definition
|
|
%End
|
|
|
|
QString selectedItem( const QStringList &parentsNamedItems = QStringList() ) throw( QgsSettingsException );
|
|
%Docstring
|
|
Returns the selected named item from the named list node
|
|
|
|
:param parentsNamedItems: the list of named items in the parent named list (if any)
|
|
|
|
:raises QgsSettingsException: if the number of given parent named items doesn't match the complete key definition
|
|
%End
|
|
|
|
void deleteItem( const QString &item, const QStringList &parentsNamedItems = QStringList() ) throw( QgsSettingsException );
|
|
%Docstring
|
|
Deletes a named item from the named list node
|
|
|
|
:param item: the item to delete
|
|
:param parentsNamedItems: the list of named items in the parent named list (if any)
|
|
|
|
:raises QgsSettingsException: if the number of given parent named items doesn't match the complete key definition
|
|
%End
|
|
|
|
void deleteAllItems( const QStringList &parentsNamedItems = QStringList() ) throw( QgsSettingsException );
|
|
%Docstring
|
|
Deletes all items from the named list node
|
|
|
|
:param parentsNamedItems: the list of named items in the parent named list (if any)
|
|
|
|
:raises QgsSettingsException: if the number of given parent named items doesn't match the complete key definition
|
|
|
|
.. versionadded:: 3.30.1
|
|
%End
|
|
|
|
const QgsSettingsEntryString *selectedItemSetting() const;
|
|
%Docstring
|
|
Returns the setting used to store the selected item
|
|
%End
|
|
|
|
protected:
|
|
void initNamedList( const Qgis::SettingsTreeNodeOptions &options );
|
|
%Docstring
|
|
Init the nodes with the specific ``options``
|
|
%End
|
|
|
|
private:
|
|
QgsSettingsTreeNamedListNode();
|
|
%Docstring
|
|
|
|
.. note::
|
|
|
|
This is not available in Python bindings. Use method createNamedListNode on an existing tree node.
|
|
|
|
.. seealso:: :py:func:`QgsSettingsTree.createPluginTreeNode`
|
|
%End
|
|
QgsSettingsTreeNamedListNode( const QgsSettingsTreeNamedListNode &other );
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/settings/qgssettingstreenode.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|