mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-22 00:14:55 -05:00
rename QgsSettingsTreeElement to QgsSettingsTreeNode
This commit is contained in:
parent
0529d6077b
commit
2a5838433b
@ -1,15 +0,0 @@
|
||||
# The following has been generated automatically from src/core/settings/qgssettingstreeelement.h
|
||||
# monkey patching scoped based enum
|
||||
QgsSettingsTreeElement.Type.Root.__doc__ = "Root Element"
|
||||
QgsSettingsTreeElement.Type.Standard.__doc__ = "Normal Element"
|
||||
QgsSettingsTreeElement.Type.NamedList.__doc__ = ""
|
||||
QgsSettingsTreeElement.Type.__doc__ = 'Type of tree element\n\n' + '* ``Root``: ' + QgsSettingsTreeElement.Type.Root.__doc__ + '\n' + '* ``Standard``: ' + QgsSettingsTreeElement.Type.Standard.__doc__ + '\n' + '* ``NamedList``: ' + QgsSettingsTreeElement.Type.NamedList.__doc__
|
||||
# --
|
||||
QgsSettingsTreeElement.Type.baseClass = QgsSettingsTreeElement
|
||||
# monkey patching scoped based enum
|
||||
QgsSettingsTreeElement.Option.NamedListSelectedItemSetting.__doc__ = "Creates a setting to store which is the current item"
|
||||
QgsSettingsTreeElement.Option.__doc__ = 'Options for named list elements\n\n' + '* ``NamedListSelectedItemSetting``: ' + QgsSettingsTreeElement.Option.NamedListSelectedItemSetting.__doc__
|
||||
# --
|
||||
QgsSettingsTreeElement.Option.baseClass = QgsSettingsTreeElement
|
||||
QgsSettingsTreeElement.Options.baseClass = QgsSettingsTreeElement
|
||||
Options = QgsSettingsTreeElement # dirty hack since SIP seems to introduce the flags in module
|
||||
@ -9,7 +9,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsApplication : QApplication
|
||||
{
|
||||
%Docstring(signature="appended")
|
||||
|
||||
@ -66,7 +66,7 @@ static bool setGlobalSettingsPath( QString path );
|
||||
};
|
||||
|
||||
|
||||
static QgsSettingsTreeElement *createPluginTreeElement( const QString &pluginName );
|
||||
static QgsSettingsTreeNode *createPluginTreeElement( const QString &pluginName );
|
||||
%Docstring
|
||||
Creates a settings tree element for the given ``pluginName``
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ Constructor for QgsSettingsEntryBase.
|
||||
%End
|
||||
|
||||
QgsSettingsEntryBase( const QString &key,
|
||||
QgsSettingsTreeElement *parentTreeElement,
|
||||
QgsSettingsTreeNode *parentTreeElement,
|
||||
const QVariant &defaultValue = QVariant(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) throw( QgsSettingsException );
|
||||
@ -313,7 +313,7 @@ Copies the settings to the given key.
|
||||
.. versionadded:: 3.30
|
||||
%End
|
||||
|
||||
QgsSettingsTreeElement *parent() const;
|
||||
QgsSettingsTreeNode *parent() const;
|
||||
%Docstring
|
||||
Returns the parent tree element
|
||||
|
||||
@ -353,7 +353,7 @@ Base abstract class for settings entry which are passed by reference
|
||||
public:
|
||||
|
||||
QgsSettingsEntryByReference( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const T &defaultValue,
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() );
|
||||
@ -503,7 +503,7 @@ Base abstract class for settings entry which are passed by value
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsSettingsEntryByValue( const QString &key, QgsSettingsTreeElement *parent, QVariant defaultValue, const QString &description = QString(), Qgis::SettingsOptions options = Qgis::SettingsOptions() );
|
||||
QgsSettingsEntryByValue( const QString &key, QgsSettingsTreeNode *parent, QVariant defaultValue, const QString &description = QString(), Qgis::SettingsOptions options = Qgis::SettingsOptions() );
|
||||
%Docstring
|
||||
Constructor for QgsSettingsEntryByValue.
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ Creates a group of setting which have a common definition of base key
|
||||
.. versionadded:: 3.26
|
||||
|
||||
.. deprecated:: QGIS 3.30
|
||||
use :py:class:`QgsSettingsTreeElement` instead
|
||||
use :py:class:`QgsSettingsTreeNode` instead
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
|
||||
@ -30,7 +30,7 @@ typedef QgsSettingsEntryByReference<QVariant> QgsSettingsEntryByReferenceQVarian
|
||||
|
||||
|
||||
QgsSettingsEntryVariant( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const QVariant &defaultValue = QVariant(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) throw( QgsSettingsException ) /Transfer/;
|
||||
@ -131,7 +131,7 @@ typedef QgsSettingsEntryByReference<QString> QgsSettingsEntryByReferenceQStringB
|
||||
public:
|
||||
|
||||
QgsSettingsEntryString( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const QString &defaultValue = QString(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions(),
|
||||
@ -245,7 +245,7 @@ typedef QgsSettingsEntryByReference<QStringList> QgsSettingsEntryByReferenceQStr
|
||||
public:
|
||||
|
||||
QgsSettingsEntryStringList( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const QStringList &defaultValue = QStringList(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) throw( QgsSettingsException ) /Transfer/;
|
||||
@ -324,7 +324,7 @@ typedef QgsSettingsEntryByValue<bool> QgsSettingsEntryByValueboolBase;
|
||||
public:
|
||||
|
||||
QgsSettingsEntryBool( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
bool defaultValue = false,
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) throw( QgsSettingsException ) /Transfer/;
|
||||
@ -403,7 +403,7 @@ typedef QgsSettingsEntryByValue<qlonglong> QgsSettingsEntryByValueqlonglongBase;
|
||||
public:
|
||||
|
||||
QgsSettingsEntryInteger( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
qlonglong defaultValue = 0,
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions(),
|
||||
@ -519,7 +519,7 @@ typedef QgsSettingsEntryByValue<double> QgsSettingsEntryByValuedoubleBase;
|
||||
public:
|
||||
|
||||
QgsSettingsEntryDouble( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
double defaultValue = 0.0,
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions(),
|
||||
@ -657,7 +657,7 @@ typedef QgsSettingsEntryByReference<QColor> QgsSettingsEntryByReferenceQColorBas
|
||||
public:
|
||||
|
||||
QgsSettingsEntryColor( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const QColor &defaultValue = QColor(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions(),
|
||||
@ -752,7 +752,7 @@ typedef QgsSettingsEntryByReference<QVariantMap> QgsSettingsEntryByReferenceQVar
|
||||
|
||||
|
||||
QgsSettingsEntryVariantMap( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const QVariantMap &defaultValue = QVariantMap(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) throw( QgsSettingsException ) /Transfer/;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/settings/qgssettingstreeelement.h *
|
||||
* src/core/settings/qgssettingstreenode.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
@ -11,10 +11,10 @@
|
||||
|
||||
|
||||
|
||||
class QgsSettingsTreeElement
|
||||
class QgsSettingsTreeNode
|
||||
{
|
||||
%Docstring(signature="appended")
|
||||
:py:class:`QgsSettingsTreeElement` is a tree element for the settings registry
|
||||
:py:class:`QgsSettingsTreeNode` is a tree element for the settings registry
|
||||
to help organizing and introspecting the registry.
|
||||
It is either a root element, a normal element or
|
||||
a named list (to store a group of settings under a dynamic named key).
|
||||
@ -29,13 +29,13 @@ to automatically register a settings entry on its creation when a parent is prov
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgssettingstreeelement.h"
|
||||
#include "qgssettingstreenode.h"
|
||||
%End
|
||||
%ConvertToSubClassCode
|
||||
if ( dynamic_cast< QgsSettingsTreeNamedListElement * >( sipCpp ) )
|
||||
sipType = sipType_QgsSettingsTreeNamedListElement;
|
||||
else if ( dynamic_cast< QgsSettingsTreeElement * >( sipCpp ) )
|
||||
sipType = sipType_QgsSettingsTreeElement;
|
||||
if ( dynamic_cast< QgsSettingsTreeNamedListNode * >( sipCpp ) )
|
||||
sipType = sipType_QgsSettingsTreeNamedListNode;
|
||||
else if ( dynamic_cast< QgsSettingsTreeNode * >( sipCpp ) )
|
||||
sipType = sipType_QgsSettingsTreeNode;
|
||||
else
|
||||
sipType = NULL;
|
||||
%End
|
||||
@ -55,13 +55,13 @@ to automatically register a settings entry on its creation when a parent is prov
|
||||
NamedListSelectedItemSetting,
|
||||
};
|
||||
|
||||
typedef QFlags<QgsSettingsTreeElement::Option> Options;
|
||||
typedef QFlags<QgsSettingsTreeNode::Option> Options;
|
||||
|
||||
|
||||
virtual ~QgsSettingsTreeElement();
|
||||
virtual ~QgsSettingsTreeNode();
|
||||
|
||||
|
||||
QgsSettingsTreeElement *createChildElement( const QString &key ) throw( QgsSettingsException ) /KeepReference/;
|
||||
QgsSettingsTreeNode *createChildElement( const QString &key ) throw( QgsSettingsException ) /KeepReference/;
|
||||
%Docstring
|
||||
Creates a normal tree element
|
||||
It will return the existing child element if it exists at the given key
|
||||
@ -69,7 +69,7 @@ It will return the existing child element if it exists at the given key
|
||||
:raises QgsSettingsException: if a setting exists with the same key
|
||||
%End
|
||||
|
||||
QgsSettingsTreeNamedListElement *createNamedListElement( const QString &key, const QgsSettingsTreeElement::Options &options = QgsSettingsTreeElement::Options() ) throw( QgsSettingsException ) /KeepReference/;
|
||||
QgsSettingsTreeNamedListNode *createNamedListElement( const QString &key, const QgsSettingsTreeNode::Options &options = QgsSettingsTreeNode::Options() ) throw( QgsSettingsException ) /KeepReference/;
|
||||
%Docstring
|
||||
Creates a named list tree element.
|
||||
This is useful to register groups of settings for several named items (for instance credentials for several named services)
|
||||
@ -108,17 +108,17 @@ Unregisters the child setting
|
||||
:param parentsNamedItems: the list of named items in the parent named list (if any)
|
||||
%End
|
||||
|
||||
void unregisterChildElement( QgsSettingsTreeElement *element );
|
||||
void unregisterChildElement( QgsSettingsTreeNode *element );
|
||||
%Docstring
|
||||
Unregisters the child tree ``element``
|
||||
%End
|
||||
|
||||
QList<QgsSettingsTreeElement *> childrenElements() const;
|
||||
QList<QgsSettingsTreeNode *> childrenElements() const;
|
||||
%Docstring
|
||||
Returns the children elements
|
||||
%End
|
||||
|
||||
QgsSettingsTreeElement *childElement( const QString &key );
|
||||
QgsSettingsTreeNode *childElement( const QString &key );
|
||||
%Docstring
|
||||
Returns the existing child element if it exists at the given ``key``
|
||||
%End
|
||||
@ -133,7 +133,7 @@ Returns the children settings
|
||||
Returns the existing child settings if it exists at the given ``key``
|
||||
%End
|
||||
|
||||
QgsSettingsTreeElement *parent() const;
|
||||
QgsSettingsTreeNode *parent() const;
|
||||
%Docstring
|
||||
Returns the parent of the element or None if it does not exists
|
||||
%End
|
||||
@ -155,14 +155,14 @@ Returns the number of named elements in the complete key
|
||||
|
||||
SIP_PYOBJECT __repr__();
|
||||
%MethodCode
|
||||
const QMetaEnum metaEnum = QMetaEnum::fromType<QgsSettingsTreeElement::Type>();
|
||||
const QMetaEnum metaEnum = QMetaEnum::fromType<QgsSettingsTreeNode::Type>();
|
||||
|
||||
QString str = QStringLiteral( "<QgsSettingsTreeElement (%1): %2>" ).arg( metaEnum.valueToKey( static_cast<int>( sipCpp->type() ) ), sipCpp->key() );
|
||||
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 registerChildElement( QgsSettingsTreeElement *element );
|
||||
void registerChildElement( QgsSettingsTreeNode *element );
|
||||
%Docstring
|
||||
Registers a child elements
|
||||
%End
|
||||
@ -170,7 +170,7 @@ Registers a child elements
|
||||
|
||||
|
||||
private:
|
||||
QgsSettingsTreeElement();
|
||||
QgsSettingsTreeNode();
|
||||
%Docstring
|
||||
|
||||
.. note::
|
||||
@ -179,19 +179,19 @@ Registers a child elements
|
||||
|
||||
.. seealso:: :py:func:`QgsSettings.createPluginTreeElement`
|
||||
%End
|
||||
QgsSettingsTreeElement( const QgsSettingsTreeElement &other );
|
||||
QgsSettingsTreeNode( const QgsSettingsTreeNode &other );
|
||||
};
|
||||
|
||||
|
||||
|
||||
class QgsSettingsTreeNamedListElement : QgsSettingsTreeElement
|
||||
class QgsSettingsTreeNamedListNode : QgsSettingsTreeNode
|
||||
{
|
||||
%Docstring(signature="appended")
|
||||
:py:class:`QgsSettingsTreeNamedListElement` is a named list tree element for the settings registry
|
||||
:py:class:`QgsSettingsTreeNamedListNode` is a named list tree element for the settings registry
|
||||
to help organizing and introspecting the registry.
|
||||
the named list element is used to store a group of settings under a dynamically named key.
|
||||
|
||||
.. seealso:: :py:class:`QgsSettingsTreeElement`
|
||||
.. seealso:: :py:class:`QgsSettingsTreeNode`
|
||||
|
||||
.. seealso:: :py:class:`QgsSettingsEntryBase`
|
||||
|
||||
@ -201,10 +201,10 @@ the named list element is used to store a group of settings under a dynamically
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgssettingstreeelement.h"
|
||||
#include "qgssettingstreenode.h"
|
||||
%End
|
||||
public:
|
||||
virtual ~QgsSettingsTreeNamedListElement();
|
||||
virtual ~QgsSettingsTreeNamedListNode();
|
||||
|
||||
QStringList items( const QStringList &parentsNamedItems = QStringList() ) const throw( QgsSettingsException );
|
||||
%Docstring
|
||||
@ -261,13 +261,13 @@ Returns the setting used to store the selected item
|
||||
%End
|
||||
|
||||
protected:
|
||||
void initNamedList( const QgsSettingsTreeElement::Options &options );
|
||||
void initNamedList( const QgsSettingsTreeNode::Options &options );
|
||||
%Docstring
|
||||
Init the elements with the specific ``options``
|
||||
%End
|
||||
|
||||
private:
|
||||
QgsSettingsTreeNamedListElement();
|
||||
QgsSettingsTreeNamedListNode();
|
||||
%Docstring
|
||||
|
||||
.. note::
|
||||
@ -276,16 +276,16 @@ Init the elements with the specific ``options``
|
||||
|
||||
.. seealso:: :py:func:`QgsSettings.createPluginTreeElement`
|
||||
%End
|
||||
QgsSettingsTreeNamedListElement( const QgsSettingsTreeNamedListElement &other );
|
||||
QgsSettingsTreeNamedListNode( const QgsSettingsTreeNamedListNode &other );
|
||||
};
|
||||
|
||||
QFlags<QgsSettingsTreeElement::Option> operator|(QgsSettingsTreeElement::Option f1, QFlags<QgsSettingsTreeElement::Option> f2);
|
||||
QFlags<QgsSettingsTreeNode::Option> operator|(QgsSettingsTreeNode::Option f1, QFlags<QgsSettingsTreeNode::Option> f2);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/settings/qgssettingstreeelement.h *
|
||||
* src/core/settings/qgssettingstreenode.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
@ -706,7 +706,6 @@
|
||||
%Include auto_generated/settings/qgssettingsentryimpl.sip
|
||||
%Include auto_generated/settings/qgssettingsregistry.sip
|
||||
%Include auto_generated/settings/qgssettingsregistrycore.sip
|
||||
%Include auto_generated/settings/qgssettingstreeelement.sip
|
||||
%Include auto_generated/validity/qgsabstractvaliditycheck.sip
|
||||
%Include auto_generated/validity/qgsvaliditycheckcontext.sip
|
||||
%Include auto_generated/validity/qgsvaliditycheckregistry.sip
|
||||
|
||||
@ -62,7 +62,7 @@ class QgsGeoreferencerMainWindow : public QMainWindow, private Ui::QgsGeorefPlug
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static inline QgsSettingsTreeElement *sTreeGeoreferencer = QgsSettings::sTreeApp->createChildElement( QStringLiteral( "georeferencer" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeGeoreferencer = QgsSettings::sTreeApp->createChildElement( QStringLiteral( "georeferencer" ) );
|
||||
|
||||
static const QgsSettingsEntryEnumFlag<QgsImageWarper::ResamplingMethod> *settingResamplingMethod;
|
||||
static const QgsSettingsEntryString *settingCompressionMethod;
|
||||
|
||||
@ -54,7 +54,7 @@ class APP_EXPORT QgsMapToolsDigitizingTechniqueManager : public QObject
|
||||
public:
|
||||
static const QgsSettingsEntryEnumFlag<Qgis::CaptureTechnique> *settingsDigitizingTechnique;
|
||||
|
||||
static inline QgsSettingsTreeElement *sTreeShapeMapTools = QgsSettings::sTreeDigitizing->createChildElement( QStringLiteral( "shape-map-tools" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeShapeMapTools = QgsSettings::sTreeDigitizing->createChildElement( QStringLiteral( "shape-map-tools" ) );
|
||||
static const QgsSettingsEntryString *settingMapToolShapeDefaultForShape;
|
||||
static const QgsSettingsEntryString *settingMapToolShapeCurrent;
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
static inline QgsSettingsTreeElement *sTreePluginManager = QgsSettings::sTreePlugins->createChildElement( QStringLiteral( "_plugin_manager" ) );
|
||||
static inline QgsSettingsTreeNode *sTreePluginManager = QgsSettings::sTreePlugins->createChildElement( QStringLiteral( "_plugin_manager" ) );
|
||||
|
||||
static const QgsSettingsEntryBool *settingsAutomaticallyCheckForPluginUpdates;
|
||||
static const QgsSettingsEntryBool *settingsAllowExperimental;
|
||||
@ -60,7 +60,7 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
|
||||
static const QgsSettingsEntryVariant *settingsCheckOnStartLastDate;
|
||||
static const QgsSettingsEntryStringList *settingsSeenPlugins;
|
||||
|
||||
static inline QgsSettingsTreeElement *sTreeUi = sTreePluginManager->createChildElement( QStringLiteral( "UI" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeUi = sTreePluginManager->createChildElement( QStringLiteral( "UI" ) );
|
||||
static const QgsSettingsEntryString *settingsLastZipDirectory;
|
||||
static const QgsSettingsEntryBool *settingsShowInstallFromZipWarning;
|
||||
|
||||
|
||||
@ -859,7 +859,7 @@ set(QGIS_CORE_SRCS
|
||||
settings/qgssettingsentryimpl.cpp
|
||||
settings/qgssettingsregistry.cpp
|
||||
settings/qgssettingsregistrycore.cpp
|
||||
settings/qgssettingstreeelement.cpp
|
||||
settings/qgssettingstreenode.cpp
|
||||
|
||||
validity/qgsabstractvaliditycheck.cpp
|
||||
validity/qgsvaliditycheckcontext.cpp
|
||||
@ -1862,7 +1862,7 @@ set(QGIS_CORE_HDRS
|
||||
settings/qgssettingsentryimpl.h
|
||||
settings/qgssettingsregistry.h
|
||||
settings/qgssettingsregistrycore.h
|
||||
settings/qgssettingstreeelement.h
|
||||
settings/qgssettingstreenode.h
|
||||
|
||||
validity/qgsabstractvaliditycheck.h
|
||||
validity/qgsvaliditycheckcontext.h
|
||||
|
||||
@ -39,7 +39,7 @@ class CORE_EXPORT QgsBabelFormatRegistry
|
||||
|
||||
#ifndef SIP_RUN
|
||||
|
||||
static inline QgsSettingsTreeNamedListElement *sTreeBabelDevices = QgsSettings::sTreeGps->createNamedListElement( QStringLiteral( "babel-devices" ) );
|
||||
static inline QgsSettingsTreeNamedListNode *sTreeBabelDevices = QgsSettings::sTreeGps->createNamedListElement( QStringLiteral( "babel-devices" ) );
|
||||
|
||||
static const QgsSettingsEntryString *settingsBabelWptDownload;
|
||||
static const QgsSettingsEntryString *settingsBabelWptUpload;
|
||||
|
||||
@ -154,7 +154,7 @@ class CORE_EXPORT QgsLocator : public QObject
|
||||
QStringList completionList() const {return mAutocompletionList;}
|
||||
|
||||
#ifndef SIP_RUN
|
||||
static inline QgsSettingsTreeNamedListElement *sTreeLocatorFilters = QgsSettings::treeRoot()->createNamedListElement( QStringLiteral( "locator-filters" ) );
|
||||
static inline QgsSettingsTreeNamedListNode *sTreeLocatorFilters = QgsSettings::treeRoot()->createNamedListElement( QStringLiteral( "locator-filters" ) );
|
||||
|
||||
//! Settings entry locator filter enabled
|
||||
static const QgsSettingsEntryBool *settingsLocatorFilterEnabled;
|
||||
|
||||
@ -109,7 +109,7 @@ class CORE_EXPORT QgsProcessing
|
||||
static const QString TEMPORARY_OUTPUT;
|
||||
|
||||
#ifndef SIP_RUN
|
||||
static inline QgsSettingsTreeElement *sTreeConfiguration = QgsSettings::sTreeQgis->createChildElement( QStringLiteral( "configuration" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeConfiguration = QgsSettings::sTreeQgis->createChildElement( QStringLiteral( "configuration" ) );
|
||||
|
||||
//! Settings entry prefer filename as layer name
|
||||
static const QgsSettingsEntryBool *settingsPreferFilenameAsLayerName;
|
||||
|
||||
@ -26,8 +26,6 @@
|
||||
#include "qgsconfig.h"
|
||||
#include "qgssettingsentryimpl.h"
|
||||
#include "qgstranslationcontext.h"
|
||||
#include "qgssettingstreeelement.h"
|
||||
|
||||
|
||||
class QgsSettingsRegistryCore;
|
||||
class Qgs3DRendererRegistry;
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
class CORE_EXPORT QgsXyzConnectionSettings SIP_SKIP
|
||||
{
|
||||
public:
|
||||
static inline QgsSettingsTreeNamedListElement *sTreeXyzConnections = QgsSettings::sTreeConnections->createNamedListElement( QStringLiteral( "xyz" ), QgsSettingsTreeElement::Option::NamedListSelectedItemSetting );
|
||||
static inline QgsSettingsTreeNamedListNode *sTreeXyzConnections = QgsSettings::sTreeConnections->createNamedListElement( QStringLiteral( "xyz" ), QgsSettingsTreeNode::Option::NamedListSelectedItemSetting );
|
||||
|
||||
static const QgsSettingsEntryString *settingsUrl;
|
||||
static const QgsSettingsEntryVariantMap *settingsHeaders;
|
||||
@ -65,8 +65,8 @@ class CORE_EXPORT QgsOwsConnection : public QObject
|
||||
public:
|
||||
|
||||
#ifndef SIP_RUN
|
||||
static inline QgsSettingsTreeNamedListElement *sTtreeOwsServices = QgsSettings::sTreeConnections->createNamedListElement( QStringLiteral( "ows" ) );
|
||||
static inline QgsSettingsTreeNamedListElement *sTreeOwsConnections = sTtreeOwsServices->createNamedListElement( QStringLiteral( "connections" ) );
|
||||
static inline QgsSettingsTreeNamedListNode *sTtreeOwsServices = QgsSettings::sTreeConnections->createNamedListElement( QStringLiteral( "ows" ) );
|
||||
static inline QgsSettingsTreeNamedListNode *sTreeOwsConnections = sTtreeOwsServices->createNamedListElement( QStringLiteral( "connections" ) );
|
||||
|
||||
static const QgsSettingsEntryString *settingsUrl;
|
||||
static const QgsSettingsEntryVariantMap *settingsHeaders;
|
||||
|
||||
@ -48,16 +48,16 @@ void QgsSettings::init()
|
||||
}
|
||||
|
||||
|
||||
QgsSettingsTreeElement *QgsSettings::treeRoot()
|
||||
QgsSettingsTreeNode *QgsSettings::treeRoot()
|
||||
{
|
||||
// this must be defined in cpp code so we are sure only one instance is around
|
||||
static QgsSettingsTreeElement *sTreeRoot = QgsSettingsTreeElement::createRootElement();
|
||||
static QgsSettingsTreeNode *sTreeRoot = QgsSettingsTreeNode::createRootElement();
|
||||
return sTreeRoot;
|
||||
}
|
||||
|
||||
QgsSettingsTreeElement *QgsSettings::createPluginTreeElement( const QString &pluginName )
|
||||
QgsSettingsTreeNode *QgsSettings::createPluginTreeElement( const QString &pluginName )
|
||||
{
|
||||
QgsSettingsTreeElement *te = sTreePlugins->childElement( pluginName );
|
||||
QgsSettingsTreeNode *te = sTreePlugins->childElement( pluginName );
|
||||
if ( te )
|
||||
return te;
|
||||
else
|
||||
@ -67,7 +67,7 @@ QgsSettingsTreeElement *QgsSettings::createPluginTreeElement( const QString &plu
|
||||
void QgsSettings::unregisterPluginTreeElement( const QString &pluginName )
|
||||
{
|
||||
//QgsDebugMsg( "unregister plugin tree element" );
|
||||
QgsSettingsTreeElement *pluginTreeElement = sTreePlugins->childElement( pluginName );
|
||||
QgsSettingsTreeNode *pluginTreeElement = sTreePlugins->childElement( pluginName );
|
||||
delete pluginTreeElement;
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include "qgis_core.h"
|
||||
#include "qgis_sip.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgssettingstreeelement.h"
|
||||
#include "qgssettingstreenode.h"
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
@ -86,30 +86,30 @@ class CORE_EXPORT QgsSettings : public QObject
|
||||
* Returns the tree root element for the settings
|
||||
* \since QGIS 3.30
|
||||
*/
|
||||
static QgsSettingsTreeElement *treeRoot();
|
||||
static QgsSettingsTreeNode *treeRoot();
|
||||
|
||||
// only create first level here
|
||||
static inline QgsSettingsTreeElement *sTreeApp = treeRoot()->createChildElement( QStringLiteral( "app" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeConnections = treeRoot()->createChildElement( QStringLiteral( "connections" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeCore = treeRoot()->createChildElement( QStringLiteral( "core" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeElevationProfile = treeRoot()->createChildElement( QStringLiteral( "elevation-profile" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeFonts = treeRoot()->createChildElement( QStringLiteral( "fonts" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeGeometryValidation = treeRoot()->createChildElement( QStringLiteral( "geometry_validation" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeGps = treeRoot()->createChildElement( QStringLiteral( "gps" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeGui = treeRoot()->createChildElement( QStringLiteral( "gui" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeLayerTree = treeRoot()->createChildElement( QStringLiteral( "layer-tree" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeLayout = treeRoot()->createChildElement( QStringLiteral( "layout" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeLocale = treeRoot()->createChildElement( QStringLiteral( "locale" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeMap = treeRoot()->createChildElement( QStringLiteral( "map" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeNetwork = treeRoot()->createChildElement( QStringLiteral( "network" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeQgis = treeRoot()->createChildElement( QStringLiteral( "qgis" ) );
|
||||
static inline QgsSettingsTreeElement *sTreePlugins = treeRoot()->createChildElement( QStringLiteral( "plugins" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeProcessing = treeRoot()->createChildElement( QStringLiteral( "processing" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeSvg = treeRoot()->createChildElement( QStringLiteral( "svg" ) );
|
||||
static inline QgsSettingsTreeElement *sTreeWms = treeRoot()->createChildElement( QStringLiteral( "wms" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeApp = treeRoot()->createChildElement( QStringLiteral( "app" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeConnections = treeRoot()->createChildElement( QStringLiteral( "connections" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeCore = treeRoot()->createChildElement( QStringLiteral( "core" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeElevationProfile = treeRoot()->createChildElement( QStringLiteral( "elevation-profile" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeFonts = treeRoot()->createChildElement( QStringLiteral( "fonts" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeGeometryValidation = treeRoot()->createChildElement( QStringLiteral( "geometry_validation" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeGps = treeRoot()->createChildElement( QStringLiteral( "gps" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeGui = treeRoot()->createChildElement( QStringLiteral( "gui" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeLayerTree = treeRoot()->createChildElement( QStringLiteral( "layer-tree" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeLayout = treeRoot()->createChildElement( QStringLiteral( "layout" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeLocale = treeRoot()->createChildElement( QStringLiteral( "locale" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeMap = treeRoot()->createChildElement( QStringLiteral( "map" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeNetwork = treeRoot()->createChildElement( QStringLiteral( "network" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeQgis = treeRoot()->createChildElement( QStringLiteral( "qgis" ) );
|
||||
static inline QgsSettingsTreeNode *sTreePlugins = treeRoot()->createChildElement( QStringLiteral( "plugins" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeProcessing = treeRoot()->createChildElement( QStringLiteral( "processing" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeSvg = treeRoot()->createChildElement( QStringLiteral( "svg" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeWms = treeRoot()->createChildElement( QStringLiteral( "wms" ) );
|
||||
|
||||
// sub levels
|
||||
static inline QgsSettingsTreeElement *sTreeDigitizing = sTreeQgis->createChildElement( QStringLiteral( "digitizing" ) );
|
||||
static inline QgsSettingsTreeNode *sTreeDigitizing = sTreeQgis->createChildElement( QStringLiteral( "digitizing" ) );
|
||||
|
||||
#endif
|
||||
|
||||
@ -117,7 +117,7 @@ class CORE_EXPORT QgsSettings : public QObject
|
||||
* Creates a settings tree element for the given \a pluginName
|
||||
* \since QGIS 3.30
|
||||
*/
|
||||
static QgsSettingsTreeElement *createPluginTreeElement( const QString &pluginName );
|
||||
static QgsSettingsTreeNode *createPluginTreeElement( const QString &pluginName );
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#include <QDir>
|
||||
|
||||
|
||||
QgsSettingsEntryBase::QgsSettingsEntryBase( const QString &key, QgsSettingsTreeElement *parentTreeElement, const QVariant &defaultValue, const QString &description, Qgis::SettingsOptions options )
|
||||
QgsSettingsEntryBase::QgsSettingsEntryBase( const QString &key, QgsSettingsTreeNode *parentTreeElement, const QVariant &defaultValue, const QString &description, Qgis::SettingsOptions options )
|
||||
: mParentTreeElement( parentTreeElement )
|
||||
, mDefaultValue( defaultValue )
|
||||
, mDescription( description )
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
#include "qgis_sip.h"
|
||||
#include "qgssettings.h"
|
||||
|
||||
class QgsSettingsTreeElement;
|
||||
class QgsSettingsTreeNode;
|
||||
|
||||
|
||||
/**
|
||||
@ -105,7 +105,7 @@ class CORE_EXPORT QgsSettingsEntryBase
|
||||
* \throws QgsSettingsException if the number of given parent named items doesn't match the complete key definition
|
||||
*/
|
||||
QgsSettingsEntryBase( const QString &key,
|
||||
QgsSettingsTreeElement *parentTreeElement,
|
||||
QgsSettingsTreeNode *parentTreeElement,
|
||||
const QVariant &defaultValue = QVariant(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) SIP_THROW( QgsSettingsException );
|
||||
@ -312,7 +312,7 @@ class CORE_EXPORT QgsSettingsEntryBase
|
||||
* Returns the parent tree element
|
||||
* \since QGIS 3.30
|
||||
*/
|
||||
QgsSettingsTreeElement *parent() const {return mParentTreeElement;}
|
||||
QgsSettingsTreeNode *parent() const {return mParentTreeElement;}
|
||||
|
||||
protected:
|
||||
|
||||
@ -328,7 +328,7 @@ class CORE_EXPORT QgsSettingsEntryBase
|
||||
|
||||
QString completeKeyPrivate( const QString &key, const QStringList &dynamicKeyPartList ) const;
|
||||
|
||||
QgsSettingsTreeElement *mParentTreeElement = nullptr;
|
||||
QgsSettingsTreeNode *mParentTreeElement = nullptr;
|
||||
QString mKey;
|
||||
QVariant mDefaultValue;
|
||||
QString mDescription;
|
||||
@ -362,7 +362,7 @@ class QgsSettingsEntryByReference : public QgsSettingsEntryBase
|
||||
* \throws QgsSettingsException if the number of given parent named items doesn't match the complete key definition
|
||||
*/
|
||||
QgsSettingsEntryByReference( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const T &defaultValue,
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() )
|
||||
@ -525,7 +525,7 @@ class QgsSettingsEntryByValue : public QgsSettingsEntryBase
|
||||
* \arg optionss specifies the options for the settings entry.
|
||||
* \throws QgsSettingsException if the number of given parent named items doesn't match the complete key definition
|
||||
*/
|
||||
QgsSettingsEntryByValue( const QString &key, QgsSettingsTreeElement *parent, QVariant defaultValue, const QString &description = QString(), Qgis::SettingsOptions options = Qgis::SettingsOptions() )
|
||||
QgsSettingsEntryByValue( const QString &key, QgsSettingsTreeNode *parent, QVariant defaultValue, const QString &description = QString(), Qgis::SettingsOptions options = Qgis::SettingsOptions() )
|
||||
: QgsSettingsEntryBase( key, parent, defaultValue, description, options )
|
||||
{}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ class QgsSettingsEntryEnumFlag : public QgsSettingsEntryByValue<T>
|
||||
* \note The enum needs to be declared with Q_ENUM, and flags with Q_FLAG (not Q_FLAGS).
|
||||
* \note for Python bindings, a custom implementation is achieved in Python directly
|
||||
*/
|
||||
QgsSettingsEntryEnumFlag( const QString &key, QgsSettingsTreeElement *parent, T defaultValue, const QString &description = QString(), Qgis::SettingsOptions options = Qgis::SettingsOptions() )
|
||||
QgsSettingsEntryEnumFlag( const QString &key, QgsSettingsTreeNode *parent, T defaultValue, const QString &description = QString(), Qgis::SettingsOptions options = Qgis::SettingsOptions() )
|
||||
: QgsSettingsEntryByValue<T>( key,
|
||||
parent,
|
||||
QMetaEnum::fromType<T>().isFlag() ? qgsFlagValueToKeys( defaultValue ) : qgsEnumValueToKey( defaultValue ),
|
||||
|
||||
@ -33,7 +33,7 @@ class QgsSettingsEntryBase;
|
||||
* \brief Creates a group of setting which have a common definition of base key
|
||||
*
|
||||
* \since QGIS 3.26
|
||||
* \deprecated since QGIS 3.30 use QgsSettingsTreeElement instead
|
||||
* \deprecated since QGIS 3.30 use QgsSettingsTreeNode instead
|
||||
*/
|
||||
class CORE_DEPRECATED_EXPORT QgsSettingsEntryGroup SIP_DEPRECATED
|
||||
{
|
||||
|
||||
@ -42,7 +42,7 @@ class CORE_EXPORT QgsSettingsEntryVariant : public QgsSettingsEntryByReference<Q
|
||||
* \since QGIS 3.30
|
||||
*/
|
||||
QgsSettingsEntryVariant( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const QVariant &defaultValue = QVariant(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) SIP_THROW( QgsSettingsException ) SIP_TRANSFER
|
||||
@ -141,7 +141,7 @@ class CORE_EXPORT QgsSettingsEntryString : public QgsSettingsEntryByReference<QS
|
||||
* \param maxLength specifies the maximal length of the string value. -1 means no limit.
|
||||
*/
|
||||
QgsSettingsEntryString( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const QString &defaultValue = QString(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions(),
|
||||
@ -256,7 +256,7 @@ class CORE_EXPORT QgsSettingsEntryStringList : public QgsSettingsEntryByReferenc
|
||||
* \param options specifies the options for the settings entry.
|
||||
*/
|
||||
QgsSettingsEntryStringList( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const QStringList &defaultValue = QStringList(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) SIP_THROW( QgsSettingsException ) SIP_TRANSFER
|
||||
@ -332,7 +332,7 @@ class CORE_EXPORT QgsSettingsEntryBool : public QgsSettingsEntryByValue<bool>
|
||||
* \param options specifies the options for the settings entry.
|
||||
*/
|
||||
QgsSettingsEntryBool( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
bool defaultValue = false,
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) SIP_THROW( QgsSettingsException ) SIP_TRANSFER
|
||||
@ -409,7 +409,7 @@ class CORE_EXPORT QgsSettingsEntryInteger : public QgsSettingsEntryByValue<qlong
|
||||
* \param maxValue specifies the maximal value.
|
||||
*/
|
||||
QgsSettingsEntryInteger( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
qlonglong defaultValue = 0,
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions(),
|
||||
@ -529,7 +529,7 @@ class CORE_EXPORT QgsSettingsEntryDouble : public QgsSettingsEntryByValue<double
|
||||
* for example for a QDoubleSpinBox.
|
||||
*/
|
||||
QgsSettingsEntryDouble( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
double defaultValue = 0.0,
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions(),
|
||||
@ -670,7 +670,7 @@ class CORE_EXPORT QgsSettingsEntryColor : public QgsSettingsEntryByReference<QCo
|
||||
* \param allowAlpha specifies if the color can have transparency.
|
||||
*/
|
||||
QgsSettingsEntryColor( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const QColor &defaultValue = QColor(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions(),
|
||||
@ -772,7 +772,7 @@ class CORE_EXPORT QgsSettingsEntryVariantMap : public QgsSettingsEntryByReferenc
|
||||
* \param options specifies the options for the settings entry.
|
||||
*/
|
||||
QgsSettingsEntryVariantMap( const QString &key,
|
||||
QgsSettingsTreeElement *parent,
|
||||
QgsSettingsTreeNode *parent,
|
||||
const QVariantMap &defaultValue = QVariantMap(),
|
||||
const QString &description = QString(),
|
||||
Qgis::SettingsOptions options = Qgis::SettingsOptions() ) SIP_THROW( QgsSettingsException ) SIP_TRANSFER
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgssettingstreeelement.cpp
|
||||
qgssettingstreenode.cpp
|
||||
--------------------------------------
|
||||
Date : December 2022
|
||||
Copyright : (C) 2022 by Denis Rouzaud
|
||||
@ -13,14 +13,14 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgssettingstreeelement.h"
|
||||
#include "qgssettingstreenode.h"
|
||||
#include "qgssettingsentryimpl.h"
|
||||
#include "qgsexception.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
|
||||
QgsSettingsTreeElement::~QgsSettingsTreeElement()
|
||||
QgsSettingsTreeNode::~QgsSettingsTreeNode()
|
||||
{
|
||||
if ( mType != Type::Root )
|
||||
mParent->unregisterChildElement( this );
|
||||
@ -29,44 +29,44 @@ QgsSettingsTreeElement::~QgsSettingsTreeElement()
|
||||
qDeleteAll( mChildrenSettings );
|
||||
}
|
||||
|
||||
QgsSettingsTreeElement *QgsSettingsTreeElement::createRootElement()
|
||||
QgsSettingsTreeNode *QgsSettingsTreeNode::createRootElement()
|
||||
{
|
||||
QgsSettingsTreeElement *te = new QgsSettingsTreeElement();
|
||||
QgsSettingsTreeNode *te = new QgsSettingsTreeNode();
|
||||
te->mType = Type::Root;
|
||||
te->mKey = QString();
|
||||
te->mCompleteKey = QStringLiteral( "/" );
|
||||
return te;
|
||||
}
|
||||
|
||||
QgsSettingsTreeElement *QgsSettingsTreeElement::createChildElement( const QString &key )
|
||||
QgsSettingsTreeNode *QgsSettingsTreeNode::createChildElement( const QString &key )
|
||||
{
|
||||
QgsSettingsTreeElement *te = childElement( key );
|
||||
QgsSettingsTreeNode *te = childElement( key );
|
||||
if ( te )
|
||||
return te;
|
||||
if ( childSetting( key ) )
|
||||
throw QgsSettingsException( QObject::tr( "Settings tree element '%1' already holds a child setting with key '%2'." ).arg( this->key(), key ) );
|
||||
|
||||
te = new QgsSettingsTreeElement();
|
||||
te = new QgsSettingsTreeNode();
|
||||
te->mType = Type::Standard;
|
||||
te->init( this, key );
|
||||
registerChildElement( te );
|
||||
return te;
|
||||
}
|
||||
|
||||
QgsSettingsTreeNamedListElement *QgsSettingsTreeElement::createNamedListElement( const QString &key, const QgsSettingsTreeElement::Options &options )
|
||||
QgsSettingsTreeNamedListNode *QgsSettingsTreeNode::createNamedListElement( const QString &key, const QgsSettingsTreeNode::Options &options )
|
||||
{
|
||||
QgsSettingsTreeElement *nte = childElement( key );
|
||||
QgsSettingsTreeNode *nte = childElement( key );
|
||||
if ( nte )
|
||||
{
|
||||
if ( nte->type() == Type::NamedList )
|
||||
return dynamic_cast<QgsSettingsTreeNamedListElement *>( nte );
|
||||
return dynamic_cast<QgsSettingsTreeNamedListNode *>( nte );
|
||||
else
|
||||
throw QgsSettingsException( QObject::tr( "Settings tree element '%1' already holds a child element with key '%2', but it is not a named list.." ).arg( this->key(), key ) );
|
||||
}
|
||||
if ( childSetting( key ) )
|
||||
throw QgsSettingsException( QObject::tr( "Settings tree element '%1' already holds a child setting with key '%2'." ).arg( this->key(), key ) );
|
||||
|
||||
QgsSettingsTreeNamedListElement *te = new QgsSettingsTreeNamedListElement();
|
||||
QgsSettingsTreeNamedListNode *te = new QgsSettingsTreeNamedListNode();
|
||||
te->mType = Type::NamedList;
|
||||
te->init( this, key );
|
||||
te->initNamedList( options );
|
||||
@ -75,9 +75,9 @@ QgsSettingsTreeNamedListElement *QgsSettingsTreeElement::createNamedListElement(
|
||||
}
|
||||
|
||||
|
||||
QgsSettingsTreeElement *QgsSettingsTreeElement::childElement( const QString &key )
|
||||
QgsSettingsTreeNode *QgsSettingsTreeNode::childElement( const QString &key )
|
||||
{
|
||||
QList<QgsSettingsTreeElement *>::const_iterator it = mChildrenElements.constBegin();
|
||||
QList<QgsSettingsTreeNode *>::const_iterator it = mChildrenElements.constBegin();
|
||||
for ( ; it != mChildrenElements.constEnd(); ++it )
|
||||
{
|
||||
if ( ( *it )->key() == key )
|
||||
@ -86,7 +86,7 @@ QgsSettingsTreeElement *QgsSettingsTreeElement::childElement( const QString &key
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const QgsSettingsEntryBase *QgsSettingsTreeElement::childSetting( const QString &key )
|
||||
const QgsSettingsEntryBase *QgsSettingsTreeNode::childSetting( const QString &key )
|
||||
{
|
||||
const QString testCompleteKey = QStringLiteral( "%1%2" ).arg( mCompleteKey, key );
|
||||
QList<const QgsSettingsEntryBase *>::const_iterator it = mChildrenSettings.constBegin();
|
||||
@ -98,7 +98,7 @@ const QgsSettingsEntryBase *QgsSettingsTreeElement::childSetting( const QString
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void QgsSettingsTreeElement::registerChildSetting( const QgsSettingsEntryBase *setting, const QString &key )
|
||||
void QgsSettingsTreeNode::registerChildSetting( const QgsSettingsEntryBase *setting, const QString &key )
|
||||
{
|
||||
if ( childElement( key ) )
|
||||
throw QgsSettingsException( QObject::tr( "Settings tree element '%1' already holds a child tree element with key '%2'." ).arg( this->key(), key ) );
|
||||
@ -109,12 +109,12 @@ void QgsSettingsTreeElement::registerChildSetting( const QgsSettingsEntryBase *s
|
||||
}
|
||||
|
||||
|
||||
void QgsSettingsTreeElement::registerChildElement( QgsSettingsTreeElement *element )
|
||||
void QgsSettingsTreeNode::registerChildElement( QgsSettingsTreeNode *element )
|
||||
{
|
||||
mChildrenElements.append( element );
|
||||
}
|
||||
|
||||
void QgsSettingsTreeElement::unregisterChildSetting( const QgsSettingsEntryBase *setting, bool deleteSettingValues, const QStringList &parentsNamedItems )
|
||||
void QgsSettingsTreeNode::unregisterChildSetting( const QgsSettingsEntryBase *setting, bool deleteSettingValues, const QStringList &parentsNamedItems )
|
||||
{
|
||||
if ( deleteSettingValues )
|
||||
setting->remove( parentsNamedItems );
|
||||
@ -122,12 +122,12 @@ void QgsSettingsTreeElement::unregisterChildSetting( const QgsSettingsEntryBase
|
||||
mChildrenSettings.removeAll( setting );
|
||||
}
|
||||
|
||||
void QgsSettingsTreeElement::unregisterChildElement( QgsSettingsTreeElement *element )
|
||||
void QgsSettingsTreeNode::unregisterChildElement( QgsSettingsTreeNode *element )
|
||||
{
|
||||
mChildrenElements.removeAll( element );
|
||||
}
|
||||
|
||||
void QgsSettingsTreeElement::init( QgsSettingsTreeElement *parent, const QString &key )
|
||||
void QgsSettingsTreeNode::init( QgsSettingsTreeNode *parent, const QString &key )
|
||||
{
|
||||
mParent = parent;
|
||||
mKey = key;
|
||||
@ -135,7 +135,7 @@ void QgsSettingsTreeElement::init( QgsSettingsTreeElement *parent, const QString
|
||||
}
|
||||
|
||||
|
||||
void QgsSettingsTreeNamedListElement::initNamedList( const QgsSettingsTreeElement::Options &options )
|
||||
void QgsSettingsTreeNamedListNode::initNamedList( const QgsSettingsTreeNode::Options &options )
|
||||
{
|
||||
mOptions = options;
|
||||
if ( options.testFlag( Option::NamedListSelectedItemSetting ) )
|
||||
@ -149,18 +149,18 @@ void QgsSettingsTreeNamedListElement::initNamedList( const QgsSettingsTreeElemen
|
||||
mCompleteKey.append( QStringLiteral( "items/%%1/" ).arg( mNamedElementsCount ) );
|
||||
}
|
||||
|
||||
QgsSettingsTreeNamedListElement::~QgsSettingsTreeNamedListElement()
|
||||
QgsSettingsTreeNamedListNode::~QgsSettingsTreeNamedListNode()
|
||||
{
|
||||
delete mSelectedItemSetting;
|
||||
}
|
||||
|
||||
|
||||
QStringList QgsSettingsTreeNamedListElement::items( const QStringList &parentsNamedItems ) const
|
||||
QStringList QgsSettingsTreeNamedListNode::items( const QStringList &parentsNamedItems ) const
|
||||
{
|
||||
return items( Qgis::SettingsOrigin::Any, parentsNamedItems );
|
||||
}
|
||||
|
||||
QStringList QgsSettingsTreeNamedListElement::items( Qgis::SettingsOrigin origin, const QStringList &parentsNamedItems ) const
|
||||
QStringList QgsSettingsTreeNamedListNode::items( Qgis::SettingsOrigin origin, const QStringList &parentsNamedItems ) const
|
||||
{
|
||||
if ( namedElementsCount() - 1 != parentsNamedItems.count() )
|
||||
throw QgsSettingsException( QObject::tr( "The number of given parent named items (%1) for the element '%2' doesn't match with the number of named items in the key (%3)." ).arg( QString::number( parentsNamedItems.count() ), mCompleteKey, QString::number( namedElementsCount() ) ) );
|
||||
@ -172,7 +172,7 @@ QStringList QgsSettingsTreeNamedListElement::items( Qgis::SettingsOrigin origin,
|
||||
return settings.childGroups( origin );
|
||||
}
|
||||
|
||||
void QgsSettingsTreeNamedListElement::setSelectedItem( const QString &item, const QStringList &parentsNamedItems )
|
||||
void QgsSettingsTreeNamedListNode::setSelectedItem( const QString &item, const QStringList &parentsNamedItems )
|
||||
{
|
||||
if ( namedElementsCount() - 1 != parentsNamedItems.count() )
|
||||
throw QgsSettingsException( QObject::tr( "The number of given parent named items (%1) for the element '%2' doesn't match with the number of named items in the key (%3)." ).arg( QString::number( parentsNamedItems.count() ), mCompleteKey, QString::number( namedElementsCount() ) ) );
|
||||
@ -182,7 +182,7 @@ void QgsSettingsTreeNamedListElement::setSelectedItem( const QString &item, cons
|
||||
mSelectedItemSetting->setValue( item, parentsNamedItems );
|
||||
}
|
||||
|
||||
QString QgsSettingsTreeNamedListElement::selectedItem( const QStringList &parentsNamedItems )
|
||||
QString QgsSettingsTreeNamedListNode::selectedItem( const QStringList &parentsNamedItems )
|
||||
{
|
||||
if ( namedElementsCount() - 1 != parentsNamedItems.count() )
|
||||
throw QgsSettingsException( QObject::tr( "The number of given parent named items (%1) for the element '%2' doesn't match with the number of named items in the key (%3)." ).arg( QString::number( parentsNamedItems.count() ), mCompleteKey, QString::number( namedElementsCount() ) ) );
|
||||
@ -192,7 +192,7 @@ QString QgsSettingsTreeNamedListElement::selectedItem( const QStringList &parent
|
||||
return mSelectedItemSetting->value( parentsNamedItems );
|
||||
}
|
||||
|
||||
void QgsSettingsTreeNamedListElement::deleteItem( const QString &item, const QStringList &parentsNamedItems )
|
||||
void QgsSettingsTreeNamedListNode::deleteItem( const QString &item, const QStringList &parentsNamedItems )
|
||||
{
|
||||
if ( namedElementsCount() - 1 != parentsNamedItems.count() )
|
||||
throw QgsSettingsException( QObject::tr( "The number of given parent named items (%1) doesn't match with the number of named items in the key (%2)." ).arg( parentsNamedItems.count(), namedElementsCount() ) );
|
||||
@ -205,7 +205,7 @@ void QgsSettingsTreeNamedListElement::deleteItem( const QString &item, const QSt
|
||||
QgsSettings().remove( key );
|
||||
}
|
||||
|
||||
QString QgsSettingsTreeNamedListElement::completeKeyWithNamedItems( const QString &key, const QStringList &namedItems ) const
|
||||
QString QgsSettingsTreeNamedListNode::completeKeyWithNamedItems( const QString &key, const QStringList &namedItems ) const
|
||||
{
|
||||
switch ( namedItems.count() )
|
||||
{
|
||||
@ -222,7 +222,7 @@ QString QgsSettingsTreeNamedListElement::completeKeyWithNamedItems( const QStrin
|
||||
case 5:
|
||||
return key.arg( namedItems[0], namedItems[1], namedItems[2], namedItems[3], namedItems[4] );
|
||||
default:
|
||||
throw QgsSettingsException( QObject::tr( "Current implementation of QgsSettingsTreeNamedListElement::items doesn't handle more than 5 parent named items" ) );
|
||||
throw QgsSettingsException( QObject::tr( "Current implementation of QgsSettingsTreeNamedListNode::items doesn't handle more than 5 parent named items" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgssettingstreeelement.h
|
||||
qgssettingstreenode.h
|
||||
--------------------------------------
|
||||
Date : December 2022
|
||||
Copyright : (C) 2022 by Denis Rouzaud
|
||||
@ -13,8 +13,8 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSSETTINGSTREEELEMENT_H
|
||||
#define QGSSETTINGSTREEELEMENT_H
|
||||
#ifndef QGSSETTINGSTREENODE_H
|
||||
#define QGSSETTINGSTREENODE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@ -23,14 +23,14 @@
|
||||
#include "qgis_sip.h"
|
||||
#include "qgssettingsregistry.h"
|
||||
|
||||
class QgsSettingsTreeNamedListElement;
|
||||
class QgsSettingsTreeNamedListNode;
|
||||
class QgsSettingsEntryString;
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
* \class QgsSettingsTreeElement
|
||||
* \brief QgsSettingsTreeElement is a tree element for the settings registry
|
||||
* \class QgsSettingsTreeNode
|
||||
* \brief QgsSettingsTreeNode is a tree element for the settings registry
|
||||
* to help organizing and introspecting the registry.
|
||||
* It is either a root element, a normal element or
|
||||
* a named list (to store a group of settings under a dynamic named key).
|
||||
@ -42,15 +42,15 @@ class QgsSettingsEntryString;
|
||||
*
|
||||
* \since QGIS 3.30
|
||||
*/
|
||||
class CORE_EXPORT QgsSettingsTreeElement
|
||||
class CORE_EXPORT QgsSettingsTreeNode
|
||||
{
|
||||
|
||||
#ifdef SIP_RUN
|
||||
SIP_CONVERT_TO_SUBCLASS_CODE
|
||||
if ( dynamic_cast< QgsSettingsTreeNamedListElement * >( sipCpp ) )
|
||||
sipType = sipType_QgsSettingsTreeNamedListElement;
|
||||
else if ( dynamic_cast< QgsSettingsTreeElement * >( sipCpp ) )
|
||||
sipType = sipType_QgsSettingsTreeElement;
|
||||
if ( dynamic_cast< QgsSettingsTreeNamedListNode * >( sipCpp ) )
|
||||
sipType = sipType_QgsSettingsTreeNamedListNode;
|
||||
else if ( dynamic_cast< QgsSettingsTreeNode * >( sipCpp ) )
|
||||
sipType = sipType_QgsSettingsTreeNode;
|
||||
else
|
||||
sipType = NULL;
|
||||
SIP_END
|
||||
@ -78,26 +78,26 @@ class CORE_EXPORT QgsSettingsTreeElement
|
||||
Q_DECLARE_FLAGS( Options, Option )
|
||||
Q_FLAG( Options )
|
||||
|
||||
virtual ~QgsSettingsTreeElement();
|
||||
virtual ~QgsSettingsTreeNode();
|
||||
|
||||
/**
|
||||
* Creates a tree root element
|
||||
* \note This is not available in Python bindings. Use QgsSettings.createPluginTreeElement instead.
|
||||
*/
|
||||
static QgsSettingsTreeElement *createRootElement() SIP_SKIP;
|
||||
static QgsSettingsTreeNode *createRootElement() SIP_SKIP;
|
||||
|
||||
/**
|
||||
* Creates a normal tree element
|
||||
* It will return the existing child element if it exists at the given key
|
||||
* \throws QgsSettingsException if a setting exists with the same key
|
||||
*/
|
||||
QgsSettingsTreeElement *createChildElement( const QString &key ) SIP_THROW( QgsSettingsException ) SIP_KEEPREFERENCE;
|
||||
QgsSettingsTreeNode *createChildElement( const QString &key ) SIP_THROW( QgsSettingsException ) SIP_KEEPREFERENCE;
|
||||
|
||||
/**
|
||||
* Creates a named list tree element.
|
||||
* This is useful to register groups of settings for several named items (for instance credentials for several named services)
|
||||
*/
|
||||
QgsSettingsTreeNamedListElement *createNamedListElement( const QString &key, const QgsSettingsTreeElement::Options &options = QgsSettingsTreeElement::Options() ) SIP_THROW( QgsSettingsException ) SIP_KEEPREFERENCE;
|
||||
QgsSettingsTreeNamedListNode *createNamedListElement( const QString &key, const QgsSettingsTreeNode::Options &options = QgsSettingsTreeNode::Options() ) SIP_THROW( QgsSettingsException ) SIP_KEEPREFERENCE;
|
||||
|
||||
|
||||
//! Returns the type of element
|
||||
@ -122,13 +122,13 @@ class CORE_EXPORT QgsSettingsTreeElement
|
||||
void unregisterChildSetting( const QgsSettingsEntryBase *setting, bool deleteSettingValues = false, const QStringList &parentsNamedItems = QStringList() );
|
||||
|
||||
//! Unregisters the child tree \a element
|
||||
void unregisterChildElement( QgsSettingsTreeElement *element );
|
||||
void unregisterChildElement( QgsSettingsTreeNode *element );
|
||||
|
||||
//! Returns the children elements
|
||||
QList<QgsSettingsTreeElement *> childrenElements() const {return mChildrenElements;}
|
||||
QList<QgsSettingsTreeNode *> childrenElements() const {return mChildrenElements;}
|
||||
|
||||
//! Returns the existing child element if it exists at the given \a key
|
||||
QgsSettingsTreeElement *childElement( const QString &key );
|
||||
QgsSettingsTreeNode *childElement( const QString &key );
|
||||
|
||||
//! Returns the children settings
|
||||
QList<const QgsSettingsEntryBase *> childrenSettings() const {return mChildrenSettings;}
|
||||
@ -137,7 +137,7 @@ class CORE_EXPORT QgsSettingsTreeElement
|
||||
const QgsSettingsEntryBase *childSetting( const QString &key );
|
||||
|
||||
//! Returns the parent of the element or nullptr if it does not exists
|
||||
QgsSettingsTreeElement *parent() const {return mParent;}
|
||||
QgsSettingsTreeNode *parent() const {return mParent;}
|
||||
|
||||
//! Returns the key of the element (without its parents)
|
||||
QString key() const {return mKey;}
|
||||
@ -151,16 +151,16 @@ class CORE_EXPORT QgsSettingsTreeElement
|
||||
#ifdef SIP_RUN
|
||||
SIP_PYOBJECT __repr__();
|
||||
% MethodCode
|
||||
const QMetaEnum metaEnum = QMetaEnum::fromType<QgsSettingsTreeElement::Type>();
|
||||
const QMetaEnum metaEnum = QMetaEnum::fromType<QgsSettingsTreeNode::Type>();
|
||||
|
||||
QString str = QStringLiteral( "<QgsSettingsTreeElement (%1): %2>" ).arg( metaEnum.valueToKey( static_cast<int>( sipCpp->type() ) ), sipCpp->key() );
|
||||
QString str = QStringLiteral( "<QgsSettingsTreeNode (%1): %2>" ).arg( metaEnum.valueToKey( static_cast<int>( sipCpp->type() ) ), sipCpp->key() );
|
||||
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
|
||||
% End
|
||||
#endif
|
||||
|
||||
protected:
|
||||
//! Registers a child elements
|
||||
void registerChildElement( QgsSettingsTreeElement *element );
|
||||
void registerChildElement( QgsSettingsTreeNode *element );
|
||||
|
||||
Type mType = Type::Root;
|
||||
|
||||
@ -171,20 +171,20 @@ class CORE_EXPORT QgsSettingsTreeElement
|
||||
* \note This is not available in Python bindings. Use method createElement on an existing tree element.
|
||||
* \see QgsSettings.createPluginTreeElement
|
||||
*/
|
||||
QgsSettingsTreeElement() = default SIP_FORCE;
|
||||
QgsSettingsTreeNode() = default SIP_FORCE;
|
||||
|
||||
QgsSettingsTreeElement( const QgsSettingsTreeElement &other ) = default SIP_FORCE;
|
||||
QgsSettingsTreeNode( const QgsSettingsTreeNode &other ) = default SIP_FORCE;
|
||||
|
||||
//! itilaize the tree element
|
||||
void init( QgsSettingsTreeElement *parent, const QString &key );
|
||||
void init( QgsSettingsTreeNode *parent, const QString &key );
|
||||
|
||||
friend class QgsSettingsTreeNamedListElement;
|
||||
friend class QgsSettingsTreeNamedListNode;
|
||||
|
||||
QgsSettingsTreeElement *childElementAtKey( const QString &key );
|
||||
QgsSettingsTreeNode *childElementAtKey( const QString &key );
|
||||
|
||||
QList<QgsSettingsTreeElement *> mChildrenElements;
|
||||
QList<QgsSettingsTreeNode *> mChildrenElements;
|
||||
QList<const QgsSettingsEntryBase *> mChildrenSettings;
|
||||
QgsSettingsTreeElement *mParent = nullptr;
|
||||
QgsSettingsTreeNode *mParent = nullptr;
|
||||
|
||||
QString mKey;
|
||||
QString mCompleteKey;
|
||||
@ -195,21 +195,21 @@ class CORE_EXPORT QgsSettingsTreeElement
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
* \class QgsSettingsTreeNamedListElement
|
||||
* \brief QgsSettingsTreeNamedListElement is a named list tree element for the settings registry
|
||||
* \class QgsSettingsTreeNamedListNode
|
||||
* \brief QgsSettingsTreeNamedListNode is a named list tree element for the settings registry
|
||||
* to help organizing and introspecting the registry.
|
||||
* the named list element is used to store a group of settings under a dynamically named key.
|
||||
*
|
||||
* \see QgsSettingsTreeElement
|
||||
* \see QgsSettingsTreeNode
|
||||
* \see QgsSettingsEntryBase
|
||||
* \see QgsSettingsRegistry
|
||||
*
|
||||
* \since QGIS 3.30
|
||||
*/
|
||||
class CORE_EXPORT QgsSettingsTreeNamedListElement : public QgsSettingsTreeElement
|
||||
class CORE_EXPORT QgsSettingsTreeNamedListNode : public QgsSettingsTreeNode
|
||||
{
|
||||
public:
|
||||
virtual ~QgsSettingsTreeNamedListElement();
|
||||
virtual ~QgsSettingsTreeNamedListNode();
|
||||
|
||||
/**
|
||||
* Returns the list of items
|
||||
@ -255,27 +255,27 @@ class CORE_EXPORT QgsSettingsTreeNamedListElement : public QgsSettingsTreeElemen
|
||||
|
||||
protected:
|
||||
//! Init the elements with the specific \a options
|
||||
void initNamedList( const QgsSettingsTreeElement::Options &options );
|
||||
void initNamedList( const QgsSettingsTreeNode::Options &options );
|
||||
|
||||
private:
|
||||
friend class QgsSettingsTreeElement;
|
||||
friend class QgsSettingsTreeNode;
|
||||
|
||||
/**
|
||||
* \note This is not available in Python bindings. Use method createNamedListElement on an existing tree element.
|
||||
* \see QgsSettings.createPluginTreeElement
|
||||
*/
|
||||
QgsSettingsTreeNamedListElement() = default SIP_FORCE;
|
||||
QgsSettingsTreeNamedListNode() = default SIP_FORCE;
|
||||
|
||||
QgsSettingsTreeNamedListElement( const QgsSettingsTreeNamedListElement &other ) = default SIP_FORCE;
|
||||
QgsSettingsTreeNamedListNode( const QgsSettingsTreeNamedListNode &other ) = default SIP_FORCE;
|
||||
|
||||
//! Returns the key with named items placeholders filled with args
|
||||
QString completeKeyWithNamedItems( const QString &key, const QStringList &namedItems ) const;
|
||||
|
||||
QgsSettingsTreeElement::Options mOptions;
|
||||
QgsSettingsTreeNode::Options mOptions;
|
||||
const QgsSettingsEntryString *mSelectedItemSetting = nullptr;
|
||||
QString mItemsCompleteKey;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsSettingsTreeElement::Options )
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsSettingsTreeNode::Options )
|
||||
|
||||
#endif // QGSSETTINGSTREEELEMENT_H
|
||||
#endif // QGSSETTINGSTREENODE_H
|
||||
@ -33,7 +33,7 @@ class CORE_EXPORT QgsVectorTileProviderConnection : public QgsAbstractProviderCo
|
||||
|
||||
#ifndef SIP_RUN
|
||||
|
||||
static inline QgsSettingsTreeNamedListElement *sTreeConnectionVectorTile = QgsSettings::sTreeConnections->createNamedListElement( QStringLiteral( "vector-tile" ), QgsSettingsTreeNamedListElement::Option::NamedListSelectedItemSetting );
|
||||
static inline QgsSettingsTreeNamedListNode *sTreeConnectionVectorTile = QgsSettings::sTreeConnections->createNamedListElement( QStringLiteral( "vector-tile" ), QgsSettingsTreeNamedListNode::Option::NamedListSelectedItemSetting );
|
||||
|
||||
static const QgsSettingsEntryString *settingsUrl;
|
||||
static const QgsSettingsEntryInteger *settingsZmin;
|
||||
|
||||
@ -74,7 +74,7 @@ class GUI_EXPORT QgsStyleManagerDialog : public QDialog, private Ui::QgsStyleMan
|
||||
public:
|
||||
#ifndef SIP_RUN
|
||||
|
||||
static inline QgsSettingsTreeElement *sTtreeStyleManager = QgsSettings::sTreeApp->createChildElement( QStringLiteral( "style-manager" ) );
|
||||
static inline QgsSettingsTreeNode *sTtreeStyleManager = QgsSettings::sTreeApp->createChildElement( QStringLiteral( "style-manager" ) );
|
||||
|
||||
/**
|
||||
* Last used folder for generic style database actions.
|
||||
|
||||
@ -417,7 +417,7 @@ ADD_PYTHON_TEST(PyQgsFileDownloader test_qgsfiledownloader.py)
|
||||
ADD_PYTHON_TEST(PyQgsSettings test_qgssettings.py)
|
||||
ADD_PYTHON_TEST(PyQgsSettingsEntry test_qgssettingsentry.py)
|
||||
ADD_PYTHON_TEST(PyQgsSettingsRegistry test_qgssettingsregistry.py)
|
||||
ADD_PYTHON_TEST(PyQgsSettingsTreeElement test_qgssettingstreeelement.py)
|
||||
ADD_PYTHON_TEST(PyQgsSettingsTreeNode test_qgssettingstreenode.py)
|
||||
ADD_PYTHON_TEST(PyQgsZipUtils test_qgsziputils.py)
|
||||
ADD_PYTHON_TEST(PyQgsSourceSelectProvider test_qgssourceselectprovider.py)
|
||||
ADD_PYTHON_TEST(PyQgsAuthManagerProxy test_authmanager_proxy.py)
|
||||
|
||||
@ -10,7 +10,7 @@ the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
"""
|
||||
|
||||
from qgis.core import QgsSettingsException, QgsSettings, QgsSettingsTreeElement, QgsSettingsEntryString, QgsSettingsEntryEnumFlag, QgsUnitTypes
|
||||
from qgis.core import QgsSettingsException, QgsSettings, QgsSettingsTreeNode, QgsSettingsEntryString, QgsSettingsEntryEnumFlag, QgsUnitTypes
|
||||
from qgis.testing import start_app, unittest
|
||||
|
||||
|
||||
@ -32,21 +32,21 @@ class TestQgsSettingsEntry(unittest.TestCase):
|
||||
|
||||
def test_constructor(self):
|
||||
with self.assertRaises(TypeError):
|
||||
QgsSettingsTreeElement()
|
||||
QgsSettingsTreeNode()
|
||||
|
||||
root = QgsSettings.createPluginTreeElement(self.pluginName)
|
||||
self.assertEqual(root.type(), QgsSettingsTreeElement.Type.Standard)
|
||||
self.assertEqual(root.type(), QgsSettingsTreeNode.Type.Standard)
|
||||
pluginsElement = root.parent()
|
||||
self.assertEqual(pluginsElement.type(), QgsSettingsTreeElement.Type.Standard)
|
||||
self.assertEqual(pluginsElement.parent().type(), QgsSettingsTreeElement.Type.Root)
|
||||
self.assertEqual(pluginsElement.type(), QgsSettingsTreeNode.Type.Standard)
|
||||
self.assertEqual(pluginsElement.parent().type(), QgsSettingsTreeNode.Type.Root)
|
||||
self.assertEqual(pluginsElement.parent().parent(), None)
|
||||
|
||||
def test_parent(self):
|
||||
root = QgsSettings.createPluginTreeElement(self.pluginName)
|
||||
self.assertEqual(root.type(), QgsSettingsTreeElement.Type.Standard)
|
||||
self.assertEqual(root.type(), QgsSettingsTreeNode.Type.Standard)
|
||||
|
||||
l1 = root.createChildElement("test-parent-level-1")
|
||||
self.assertEqual(l1.type(), QgsSettingsTreeElement.Type.Standard)
|
||||
self.assertEqual(l1.type(), QgsSettingsTreeNode.Type.Standard)
|
||||
self.assertEqual(l1.key(), "test-parent-level-1")
|
||||
self.assertEqual(l1.completeKey(), f"/plugins/{self.pluginName}/test-parent-level-1/")
|
||||
self.assertEqual(l1.parent(), root)
|
||||
@ -54,7 +54,7 @@ class TestQgsSettingsEntry(unittest.TestCase):
|
||||
self.assertEqual(root.childrenSettings(), [])
|
||||
|
||||
l1a = l1.createChildElement("level-a")
|
||||
self.assertEqual(l1a.type(), QgsSettingsTreeElement.Type.Standard)
|
||||
self.assertEqual(l1a.type(), QgsSettingsTreeNode.Type.Standard)
|
||||
self.assertEqual(l1a.key(), "level-a")
|
||||
self.assertEqual(l1a.completeKey(), f"/plugins/{self.pluginName}/test-parent-level-1/level-a/")
|
||||
self.assertEqual(l1a.parent(), l1)
|
||||
@ -84,7 +84,7 @@ class TestQgsSettingsEntry(unittest.TestCase):
|
||||
self.assertEqual(nl.childrenSettings(), [])
|
||||
|
||||
# nesting lists
|
||||
nl2 = nl.createNamedListElement("my_nested_list", QgsSettingsTreeElement.Option.NamedListSelectedItemSetting)
|
||||
nl2 = nl.createNamedListElement("my_nested_list", QgsSettingsTreeNode.Option.NamedListSelectedItemSetting)
|
||||
self.assertEqual(nl2.key(), "my_nested_list")
|
||||
self.assertEqual(nl2.completeKey(), f"/plugins/{self.pluginName}/level-1/my_list/items/%1/my_nested_list/items/%2/")
|
||||
self.assertEqual(nl2.namedElementsCount(), 2)
|
||||
Loading…
x
Reference in New Issue
Block a user