mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-25 00:05:24 -04:00
612 lines
19 KiB
Plaintext
612 lines
19 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/settings/qgssettingsentry.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsSettingsEntryGroup
|
|
{
|
|
%Docstring(signature="appended")
|
|
Creates a group of setting which have a common definition of base key
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgssettingsentry.h"
|
|
%End
|
|
public:
|
|
QgsSettingsEntryGroup( const QList<const QgsSettingsEntryBase *> settings );
|
|
%Docstring
|
|
Constructor
|
|
%End
|
|
%MethodCode
|
|
sipCpp = new QgsSettingsEntryGroup( *a0, false );
|
|
sipIsErr = sipCpp->isValid() ? 0 : 1;
|
|
if ( sipIsErr )
|
|
PyErr_SetString( PyExc_ValueError, QStringLiteral( "Settings do not share the same base definition key for this group. This will lead to unpredictable results." ).toUtf8().constData() );
|
|
%End
|
|
|
|
|
|
bool isValid() const;
|
|
%Docstring
|
|
Returns if the group is valid (if settings share the same base key)
|
|
%End
|
|
|
|
QString baseKey( const QStringList &dynamicKeyPartList = QStringList() ) const;
|
|
%Docstring
|
|
Returns the base key for the given ``dynamicKeyPartList``
|
|
%End
|
|
|
|
const QList<const QgsSettingsEntryBase *> settings() const;
|
|
%Docstring
|
|
Returns all the settings
|
|
%End
|
|
|
|
void removeAllSettingsAtBaseKey( const QStringList &dynamicKeyPartList = QStringList() ) const;
|
|
%Docstring
|
|
Removes all the settings at the base key for the given ``dynamicKeyPartList``
|
|
This means it might remove more settings than the ones registered in the group, use with caution
|
|
%End
|
|
|
|
void removeAllChildrenSettings( const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Removes all the settings from this group
|
|
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
|
|
%End
|
|
|
|
void removeAllChildrenSettings( const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Removes all the settings from this group
|
|
The ``dynamicKeyPartList`` argument specifies the dynamic part of the settings key.
|
|
%End
|
|
|
|
};
|
|
|
|
class QgsSettingsEntryBase
|
|
{
|
|
%Docstring(signature="appended")
|
|
|
|
Represent settings entry and provides methods for reading and writing settings values.
|
|
Different subclasses are provided for different settings types with metainformations
|
|
to validate set values and provide more accurate settings description for the gui.
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgssettingsentry.h"
|
|
%End
|
|
%ConvertToSubClassCode
|
|
if ( dynamic_cast< QgsSettingsEntryVariant * >( sipCpp ) )
|
|
sipType = sipType_QgsSettingsEntryVariant;
|
|
else if ( dynamic_cast< QgsSettingsEntryString * >( sipCpp ) )
|
|
sipType = sipType_QgsSettingsEntryString;
|
|
else if ( dynamic_cast< QgsSettingsEntryStringList * >( sipCpp ) )
|
|
sipType = sipType_QgsSettingsEntryStringList;
|
|
else if ( dynamic_cast< QgsSettingsEntryBool * >( sipCpp ) )
|
|
sipType = sipType_QgsSettingsEntryBool;
|
|
else if ( dynamic_cast< QgsSettingsEntryInteger * >( sipCpp ) )
|
|
sipType = sipType_QgsSettingsEntryInteger;
|
|
else if ( dynamic_cast< QgsSettingsEntryDouble * >( sipCpp ) )
|
|
sipType = sipType_QgsSettingsEntryDouble;
|
|
else if ( dynamic_cast< QgsSettingsEntryColor * >( sipCpp ) )
|
|
sipType = sipType_QgsSettingsEntryColor;
|
|
else
|
|
sipType = NULL;
|
|
%End
|
|
public:
|
|
|
|
static QStringList dynamicKeyPartToList( const QString &dynamicKeyPart );
|
|
%Docstring
|
|
Transforms a dynamic key part string to list
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
|
|
QgsSettingsEntryBase( const QString &key,
|
|
const QString §ion,
|
|
const QVariant &defaultValue = QVariant(),
|
|
const QString &description = QString(),
|
|
Qgis::SettingsOptions options = Qgis::SettingsOptions() );
|
|
%Docstring
|
|
Constructor for QgsSettingsEntryBase.
|
|
|
|
The ``key`` argument specifies the key of the settings.
|
|
The ``section`` argument specifies the section.
|
|
The ``defaultValue`` argument specifies the default value for the settings entry.
|
|
The ``description`` argument specifies a description for the settings entry.
|
|
The ``options`` argument specifies the options for the settings entry.
|
|
%End
|
|
|
|
virtual ~QgsSettingsEntryBase();
|
|
|
|
QString key( const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Returns settings entry key.
|
|
|
|
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
|
|
%End
|
|
|
|
QString key( const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns settings entry key.
|
|
|
|
The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key.
|
|
%End
|
|
|
|
bool keyIsValid( const QString &key ) const;
|
|
%Docstring
|
|
Returns ``True`` if the provided key match the settings entry.
|
|
|
|
This is useful for settings with dynamic keys. For example this permits one to check that
|
|
the settings key "NewsFeed/httpsfeedqgisorg/27/content" is valid for the settings entry
|
|
defined with the key "NewsFeed/%1/%2/content"
|
|
|
|
The ``key`` to check
|
|
%End
|
|
|
|
QString definitionKey() const;
|
|
%Docstring
|
|
Returns settings entry defining key.
|
|
For dynamic settings it return the key with the placeholder for dynamic part
|
|
included. For non-dynamic settings returns the same as :py:func:`~QgsSettingsEntryBase.key`.
|
|
%End
|
|
|
|
bool hasDynamicKey() const;
|
|
%Docstring
|
|
Returns ``True`` if a part of the settings key is built dynamically.
|
|
%End
|
|
|
|
Qgis::SettingsOptions options() const;
|
|
%Docstring
|
|
Returns the settings options
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
bool exists( const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Returns ``True`` if the settings is contained in the underlying QSettings.
|
|
|
|
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
|
|
%End
|
|
|
|
bool exists( const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns ``True`` if the settings is contained in the underlying QSettings.
|
|
|
|
The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key.
|
|
%End
|
|
|
|
void remove( const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Removes the settings from the underlying QSettings.
|
|
|
|
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
|
|
%End
|
|
|
|
void remove( const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Removes the settings from the underlying QSettings.
|
|
|
|
The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key.
|
|
%End
|
|
|
|
QgsSettings::Section section() const;
|
|
%Docstring
|
|
Returns settings section. The settings section of the parent group is returned if available.
|
|
|
|
.. deprecated:: QGIS 3.26
|
|
the key is entirely self-defined
|
|
%End
|
|
|
|
virtual bool setVariantValue( const QVariant &value, const QString &dynamicKeyPart = QString() ) const /Deprecated/;
|
|
%Docstring
|
|
Set settings value.
|
|
|
|
The ``value`` to set.
|
|
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
|
|
|
|
.. deprecated:: QGIS 3.26
|
|
use setVariantValuePrivate or an implementation setValue instead
|
|
%End
|
|
|
|
virtual bool setVariantValue( const QVariant &value, const QStringList &dynamicKeyPartList ) const /Deprecated/;
|
|
%Docstring
|
|
Set settings value.
|
|
|
|
The ``value`` to set.
|
|
The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key.
|
|
|
|
.. deprecated:: QGIS 3.26
|
|
use setVariantValuePrivate or an implementation setValue instead
|
|
%End
|
|
|
|
QVariant valueAsVariant( const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Returns settings value with the ``dynamicKeyPart`` argument specifying the dynamic part of the settings key.
|
|
%End
|
|
|
|
QVariant valueAsVariant( const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns settings value with the ``dynamicKeyPart`` argument specifying the dynamic part of the settings key.
|
|
%End
|
|
|
|
QVariant valueAsVariantWithDefaultOverride( const QVariant &defaultValueOverride, const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Returns settings value with a ``defaultValueOverride``
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
QVariant valueAsVariantWithDefaultOverride( const QVariant &defaultValueOverride, const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns settings value.
|
|
|
|
The ``dynamicKeyPartList`` argument specifies the list of dynamic parts of the settings key.
|
|
The ``defaultValueOverride`` argument if valid is used instead of the normal default value.
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
QVariant valueAsVariant( const QString &dynamicKeyPart, bool useDefaultValueOverride, const QVariant &defaultValueOverride ) const /Deprecated/;
|
|
%Docstring
|
|
Returns settings value with an optional default value override
|
|
|
|
.. deprecated:: QGIS 3.26
|
|
use valueAsVariantWithDefaultOverride instead
|
|
%End
|
|
|
|
QVariant valueAsVariant( const QStringList &dynamicKeyPartList, bool useDefaultValueOverride, const QVariant &defaultValueOverride ) const /Deprecated/;
|
|
%Docstring
|
|
Returns settings value with an optional default value override
|
|
|
|
.. deprecated:: QGIS 3.26
|
|
use valueAsVariantWithDefaultOverride instead
|
|
%End
|
|
|
|
|
|
QVariant defaultValueAsVariant() const;
|
|
%Docstring
|
|
Returns settings default value.
|
|
%End
|
|
|
|
virtual Qgis::SettingsType settingsType() const = 0;
|
|
%Docstring
|
|
Returns the settings entry type.
|
|
%End
|
|
|
|
QString description() const;
|
|
%Docstring
|
|
Returns the settings entry description.
|
|
%End
|
|
|
|
QVariant formerValueAsVariant( const QString &dynamicKeyPart ) const;
|
|
%Docstring
|
|
Returns the former value of the settings if it has been enabled in the options.
|
|
Returns the current value (or default) if there is no former value.
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
QVariant formerValueAsVariant( const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns the former value of the settings if it has been enabled in the options
|
|
Returns the current value (or default) if there is no former value.
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
bool migrateFromKey( const QString &oldKey, const QString &oldSection = QString(), const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Check if the settings does not exist and try to set it from a given ``oldKey`` and ``oldSection``
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
bool migrateFromKey( const QString &oldKey, const QString &oldSection, const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Check if the settings does not exist and try to set it from a given ``oldKey``
|
|
|
|
.. note::
|
|
|
|
The old key must contain its section (the section from the current setting will not be prepended)
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
protected:
|
|
|
|
bool setVariantValuePrivate( const QVariant &value, const QStringList &dynamicKeyPartList = QStringList() ) const;
|
|
%Docstring
|
|
Sets the settings value with a variant value.
|
|
This should be called from any implementation as it takes care of actually calling QSettings
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
};
|
|
|
|
|
|
template<T>
|
|
class QgsSettingsEntryByReference : QgsSettingsEntryBase
|
|
{
|
|
%Docstring(signature="appended")
|
|
|
|
Base abstract class for settings entry which are passed by reference
|
|
|
|
.. seealso:: :py:class:`QgsSettingsEntryBase`
|
|
|
|
.. seealso:: :py:class:`QgsSettingsEntryByValue`
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgssettingsentry.h"
|
|
%End
|
|
public:
|
|
|
|
QgsSettingsEntryByReference( const QString &key,
|
|
const QString §ion,
|
|
const T &defaultValue,
|
|
const QString &description = QString(),
|
|
Qgis::SettingsOptions options = Qgis::SettingsOptions() );
|
|
%Docstring
|
|
Constructor for QgsSettingsEntryByReference.
|
|
|
|
The ``key`` argument specifies the key of the settings.
|
|
The ``defaultValue`` argument specifies the default value for the settings entry.
|
|
The ``description`` argument specifies a description for the settings entry.
|
|
The ``options`` arguments specifies the options for the settings entry.
|
|
%End
|
|
|
|
|
|
virtual Qgis::SettingsType settingsType() const = 0;
|
|
|
|
T value( const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Returns settings value.
|
|
|
|
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
|
|
The ``defaultValueOverride`` argument if valid is used instead of the normal default value.
|
|
%End
|
|
|
|
T value( const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns settings value.
|
|
|
|
The ``dynamicKeyPartList`` argument specifies the list of dynamic parts of the settings key.
|
|
The ``defaultValueOverride`` argument if valid is used instead of the normal default value.
|
|
%End
|
|
|
|
T valueWithDefaultOverride( const T &defaultValueOverride, const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Returns the settings value with a ``defaultValueOverride`` and with an optional ``dynamicKeyPart``
|
|
%End
|
|
|
|
T valueWithDefaultOverride( const T &defaultValueOverride, const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns the settings value with a ``defaultValueOverride`` for the ``dynamicKeyPartList``
|
|
%End
|
|
|
|
T value( const QString &dynamicKeyPart, bool useDefaultValueOverride, const T &defaultValueOverride ) const /Deprecated/;
|
|
%Docstring
|
|
Returns the settings value for the ``dynamicKeyPart`` and with a ``defaultValueOverride``
|
|
|
|
.. deprecated:: QGIS 3.26
|
|
use valueAsVariantWithDefaultOverride instead
|
|
%End
|
|
|
|
T value( const QStringList &dynamicKeyPartList, bool useDefaultValueOverride, const T &defaultValueOverride ) const /Deprecated/;
|
|
%Docstring
|
|
Returns the settings value for the ``dynamicKeyPartList`` and with a ``defaultValueOverride``
|
|
|
|
.. deprecated:: QGIS 3.26
|
|
use valueAsVariantWithDefaultOverride instead
|
|
%End
|
|
|
|
bool setValue( const T &value, const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Set settings value.
|
|
|
|
The ``value`` to set.
|
|
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
|
|
%End
|
|
|
|
bool setValue( const T &value, const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Set settings value.
|
|
|
|
The ``value`` to set.
|
|
The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key.
|
|
%End
|
|
|
|
T defaultValue() const;
|
|
%Docstring
|
|
Returns settings default value.
|
|
%End
|
|
|
|
T formerValue( const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Returns the former value.
|
|
Returns the current value (or default) if there is no former value.
|
|
%End
|
|
|
|
T formerValue( const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns the former value
|
|
Returns the current value (or default) if there is no former value.
|
|
%End
|
|
|
|
protected:
|
|
bool setValuePrivate( const T &value, const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Sets the settings value with an optional list of dynamic parts
|
|
%End
|
|
|
|
virtual T convertFromVariant( const QVariant &value ) const = 0;
|
|
%Docstring
|
|
Converts the variant value to the value type of the setting
|
|
%End
|
|
|
|
virtual QVariant convertToVariant( const T &value ) const;
|
|
%Docstring
|
|
Converts the value to a variant
|
|
%End
|
|
|
|
virtual bool checkValue( const T &value ) const;
|
|
%Docstring
|
|
Check if the value is valid
|
|
%End
|
|
};
|
|
|
|
|
|
template<T>
|
|
class QgsSettingsEntryByValue : QgsSettingsEntryBase
|
|
{
|
|
%Docstring(signature="appended")
|
|
|
|
Base abstract class for settings entry which are passed by value
|
|
|
|
.. seealso:: :py:class:`QgsSettingsEntryBase`
|
|
|
|
.. seealso:: :py:class:`QgsSettingsEntryByReference`
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgssettingsentry.h"
|
|
%End
|
|
public:
|
|
|
|
|
|
QgsSettingsEntryByValue( const QString &key, const QString §ion, QVariant defaultValue, const QString &description = QString(), Qgis::SettingsOptions options = Qgis::SettingsOptions() );
|
|
%Docstring
|
|
Constructor for QgsSettingsEntryByValue.
|
|
|
|
The ``key`` argument specifies the key of the settings.
|
|
The ``section`` argument specifies the section.
|
|
The ``defaultValue`` argument specifies the default value for the settings entry.
|
|
The ``description`` argument specifies a description for the settings entry.
|
|
The ``options`` arguments specifies the options for the settings entry.
|
|
%End
|
|
|
|
virtual Qgis::SettingsType settingsType() const = 0;
|
|
|
|
T value( const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Returns settings value.
|
|
|
|
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
|
|
The ``defaultValueOverride`` argument if valid is used instead of the normal default value.
|
|
%End
|
|
|
|
T value( const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns settings value.
|
|
|
|
The ``dynamicKeyPartList`` argument specifies the list of dynamic parts of the settings key.
|
|
The ``defaultValueOverride`` argument if valid is used instead of the normal default value.
|
|
%End
|
|
|
|
T valueWithDefaultOverride( T defaultValueOverride, const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Returns the settings value with a ``defaultValueOverride`` and with an optional ``dynamicKeyPart``
|
|
%End
|
|
|
|
T valueWithDefaultOverride( T defaultValueOverride, const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns the settings value with a ``defaultValueOverride`` for the ``dynamicKeyPartList``
|
|
%End
|
|
|
|
T value( const QString &dynamicKeyPart, bool useDefaultValueOverride, T defaultValueOverride ) const /Deprecated/;
|
|
%Docstring
|
|
Returns the settings value for the ``dynamicKeyPart`` and with a ``defaultValueOverride``
|
|
|
|
.. deprecated:: QGIS 3.26
|
|
use valueWithDefaultOverride instead
|
|
%End
|
|
|
|
T value( const QStringList &dynamicKeyPartList, bool useDefaultValueOverride, T defaultValueOverride ) const /Deprecated/;
|
|
%Docstring
|
|
Returns the settings value for the ``dynamicKeyPartList`` and with a ``defaultValueOverride``
|
|
|
|
.. deprecated:: QGIS 3.26
|
|
use valueWithDefaultOverride instead
|
|
%End
|
|
|
|
bool setValue( T value, const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Set settings value.
|
|
|
|
The ``value`` to set.
|
|
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
|
|
%End
|
|
|
|
bool setValue( T value, const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Set settings value.
|
|
|
|
The ``value`` to set.
|
|
The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key.
|
|
%End
|
|
|
|
T defaultValue() const;
|
|
%Docstring
|
|
Returns settings default value.
|
|
%End
|
|
|
|
T formerValue( const QString &dynamicKeyPart = QString() ) const;
|
|
%Docstring
|
|
Returns the former value
|
|
Returns the current value (or default) if there is no former value.
|
|
%End
|
|
|
|
T formerValue( const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Returns the former value
|
|
Returns the current value (or default) if there is no former value.
|
|
%End
|
|
|
|
protected:
|
|
virtual bool setValuePrivate( T value, const QStringList &dynamicKeyPartList ) const;
|
|
%Docstring
|
|
Sets the settings value with an optional list of dynamic parts
|
|
%End
|
|
|
|
virtual T convertFromVariant( const QVariant &value ) const = 0;
|
|
%Docstring
|
|
Converts the variant value to the value type of the setting
|
|
%End
|
|
|
|
virtual QVariant convertToVariant( T value ) const;
|
|
%Docstring
|
|
Converts the value to a variant
|
|
%End
|
|
|
|
virtual bool checkValue( T value ) const;
|
|
%Docstring
|
|
Check if the value is valid
|
|
%End
|
|
};
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/settings/qgssettingsentry.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|