QGIS API Documentation 4.3.0-Master (91d4a333d5d)
Loading...
Searching...
No Matches
QgsSettingsEntryBase Class Reference

Represents a settings entry and provides methods for reading and writing settings values. More...

#include <qgssettingsentry.h>

Inheritance diagram for QgsSettingsEntryBase:

Public Member Functions

 QgsSettingsEntryBase (const QString &key, const QString &section, const QVariant &defaultValue=QVariant(), const QString &description=QString(), Qgis::SettingsOptions options=Qgis::SettingsOptions())
 Constructor for QgsSettingsEntryBase.
 QgsSettingsEntryBase (const QString &name, QgsSettingsTreeNode *parent, const QVariant &defaultValue=QVariant(), const QString &description=QString(), Qgis::SettingsOptions options=Qgis::SettingsOptions())
 Constructor for QgsSettingsEntryBase.
virtual ~QgsSettingsEntryBase ()
virtual bool checkValueVariant (const QVariant &value) const
 Returns true if the given value is valid towards the setting definition.
bool copyValueFromKey (const QString &key, bool removeSettingAtKey=false) const
 Copies the value from a given key if it exists.
bool copyValueFromKey (const QString &key, const QStringList &dynamicKeyPartList, bool removeSettingAtKey=false) const
 Copies the value from a given key if it exists.
void copyValueToKey (const QString &key, const QStringList &dynamicKeyPartList=QStringList()) const
 Copies the settings to the given key.
void copyValueToKeyIfChanged (const QString &key, const QStringList &dynamicKeyPartList=QStringList()) const
 Copies the settings to the given key, if it has changed during the current QGIS session (see hasChanged()).
QVariant defaultValueAsVariant () const
 Returns settings default value.
QString definitionKey () const
 Returns settings entry defining key.
QString description () const
 Returns the settings entry description.
bool exists (const QString &dynamicKeyPart=QString()) const
 Returns true if the settings is contained in the underlying QSettings.
bool exists (const QStringList &dynamicKeyPartList) const
 Returns true if the settings is contained in the underlying QSettings.
QVariant formerValueAsVariant (const QString &dynamicKeyPart) const
 Returns the former value of the settings if it has been enabled in the options.
QVariant formerValueAsVariant (const QStringList &dynamicKeyPartList) const
 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.
bool hasChanged () const
 Returns true if the setting was changed during the current QGIS session.
bool hasDynamicKey () const
 Returns true if a part of the settings key is built dynamically.
QString key (const QString &dynamicKeyPart=QString()) const
 Returns settings entry key.
QString key (const QStringList &dynamicKeyPartList) const
 Returns settings entry key.
bool keyIsValid (const QString &key) const
 Returns true if the provided key match the settings entry.
QString name () const
 Returns the name of the settings.
Qgis::SettingsOptions options () const
 Returns the settings options.
Qgis::SettingsOrigin origin (const QStringList &dynamicKeyPartList) const
 Returns the origin of the setting if it exists.
QgsSettingsTreeNode * parent () const
 Returns the parent tree element.
void remove (const QString &dynamicKeyPart=QString()) const
 Removes the settings from the underlying QSettings.
void remove (const QStringList &dynamicKeyPartList) const
 Removes the settings from the underlying QSettings.
Q_DECL_DEPRECATED int section () const
 Returns settings section.
virtual Qgis::SettingsType settingsType () const
 Returns the settings entry type.
bool setVariantValue (const QVariant &value, const QString &dynamicKeyPart=QString()) const
 Set settings value.
bool setVariantValue (const QVariant &value, const QStringList &dynamicKeyPartList) const
 Set settings value.
virtual QString typeId () const
 Returns the id of the type of settings This can be re-implemented in a custom implementation of a setting.
Q_DECL_DEPRECATED QVariant valueAsVariant (const QString &dynamicKeyPart, bool useDefaultValueOverride, const QVariant &defaultValueOverride) const
 Returns settings value with an optional default value override.
QVariant valueAsVariant (const QString &dynamicKeyPart=QString()) const
 Returns settings value with.
QVariant valueAsVariant (const QStringList &dynamicKeyPartList) const
 Returns settings value with.
Q_DECL_DEPRECATED QVariant valueAsVariant (const QStringList &dynamicKeyPartList, bool useDefaultValueOverride, const QVariant &defaultValueOverride) const
 Returns settings value with an optional default value override.
QVariant valueAsVariantWithDefaultOverride (const QVariant &defaultValueOverride, const QString &dynamicKeyPart=QString()) const
 Returns settings value with a defaultValueOverride.
QVariant valueAsVariantWithDefaultOverride (const QVariant &defaultValueOverride, const QStringList &dynamicKeyPartList) const
 Returns settings value.

Static Public Member Functions

static QStringList dynamicKeyPartToList (const QString &dynamicKeyPart)
 Transforms a dynamic key part string to list.
static QStringList globalChildGroups (const QString &prefix)
 Returns the list of child group names found under prefix in the global defaults hash.
static QVariant globalDefault (const QString &key)
 Returns the global default value for the given key, or an invalid QVariant if not found.
static bool hasGlobalDefault (const QString &key)
 Returns true if the global settings INI file contains a value for the given key.
static bool setGlobalSettingsPath (const QString &path)
 Sets the path to the global settings INI file and loads all keys into an in-memory hash for use as default values by QgsSettingsEntry.
static void setupUserSettings (const QString &profilePath)
 Configures QSettings to use IniFormat at the given profilePath so that each thread's QSettings instance is recreated on next access with the correct format and path.
static QSettings & userSettings ()
 Returns a reference to the thread-local QSettings instance used internally by all QgsSettingsEntry operations.

Detailed Description

Represents a settings entry and provides methods for reading and writing settings values.

Different subclasses are provided for different settings types with metainformation to validate set values and provide more accurate settings description for the gui.

Since
QGIS 3.20

Definition at line 49 of file qgssettingsentry.h.

Constructor & Destructor Documentation

◆ QgsSettingsEntryBase() [1/2]

QgsSettingsEntryBase::QgsSettingsEntryBase ( const QString & key,
const QString & section,
const QVariant & defaultValue = QVariant(),
const QString & description = QString(),
Qgis::SettingsOptions options = Qgis::SettingsOptions() )
inline

Constructor for QgsSettingsEntryBase.

Parameters
keyspecifies the key of the settings.
sectionspecifies the section.
defaultValuespecifies the default value for the settings entry.
descriptionspecifies a description for the settings entry.
optionsspecifies the options for the settings entry.

Definition at line 165 of file qgssettingsentry.h.

◆ QgsSettingsEntryBase() [2/2]

QgsSettingsEntryBase::QgsSettingsEntryBase ( const QString & name,
QgsSettingsTreeNode * parent,
const QVariant & defaultValue = QVariant(),
const QString & description = QString(),
Qgis::SettingsOptions options = Qgis::SettingsOptions() )

Constructor for QgsSettingsEntryBase.

Parameters
namespecifies the name of the setting.
parentspecifies the parent in the tree of settings.
defaultValuespecifies the default value for the settings entry.
descriptionspecifies a description for the settings entry.
optionsspecifies the options for the settings entry.
Exceptions
QgsSettingsExceptionif the number of given parent named items doesn't match the complete key definition
Since
QGIS 3.30

Definition at line 153 of file qgssettingsentry.cpp.

◆ ~QgsSettingsEntryBase()

QgsSettingsEntryBase::~QgsSettingsEntryBase ( )
virtual

Definition at line 168 of file qgssettingsentry.cpp.

Member Function Documentation

◆ checkValueVariant()

virtual bool QgsSettingsEntryBase::checkValueVariant ( const QVariant & value) const
inlinevirtual

Returns true if the given value is valid towards the setting definition.

Reimplemented in QgsSettingsEntryBaseTemplate< T >, QgsSettingsEntryBaseTemplate< bool >, QgsSettingsEntryBaseTemplate< ColorTextFormat >, QgsSettingsEntryBaseTemplate< double >, QgsSettingsEntryBaseTemplate< ENUM >, QgsSettingsEntryBaseTemplate< FLAGS >, QgsSettingsEntryBaseTemplate< IdentifyMode >, QgsSettingsEntryBaseTemplate< int >, QgsSettingsEntryBaseTemplate< QColor >, QgsSettingsEntryBaseTemplate< Qgis::CadMeasurementDisplayType >, QgsSettingsEntryBaseTemplate< Qgis::DpiMode >, QgsSettingsEntryBaseTemplate< Qgis::EmbeddedScriptMode >, QgsSettingsEntryBaseTemplate< Qgis::EndCapStyle >, QgsSettingsEntryBaseTemplate< Qgis::GpsConnectionType >, QgsSettingsEntryBaseTemplate< Qgis::GpsInformationComponent >, QgsSettingsEntryBaseTemplate< Qgis::HttpMethod >, QgsSettingsEntryBaseTemplate< Qgis::JoinStyle >, QgsSettingsEntryBaseTemplate< Qgis::LayerTreeInsertionMethod >, QgsSettingsEntryBaseTemplate< Qgis::LegendSyncMode >, QgsSettingsEntryBaseTemplate< Qgis::MapToolUnit >, QgsSettingsEntryBaseTemplate< Qgis::ShadowQuality >, QgsSettingsEntryBaseTemplate< Qgis::SnappingMode >, QgsSettingsEntryBaseTemplate< Qgis::SnappingType >, QgsSettingsEntryBaseTemplate< Qgis::TextureFilterQuality >, QgsSettingsEntryBaseTemplate< Qgis::TilePixelRatio >, QgsSettingsEntryBaseTemplate< Qgis::UnknownLayerCrsBehavior >, QgsSettingsEntryBaseTemplate< Qgis::VectorRenderingSimplificationFlags >, QgsSettingsEntryBaseTemplate< Qgis::VectorSimplificationAlgorithm >, QgsSettingsEntryBaseTemplate< QgsAbstractGeometry::SegmentationToleranceType >, QgsSettingsEntryBaseTemplate< qlonglong >, QgsSettingsEntryBaseTemplate< QString >, QgsSettingsEntryBaseTemplate< QStringList >, QgsSettingsEntryBaseTemplate< Qt::TimeSpec >, QgsSettingsEntryBaseTemplate< QVariant >, and QgsSettingsEntryBaseTemplate< QVariantMap >.

Definition at line 416 of file qgssettingsentry.h.

◆ copyValueFromKey() [1/2]

bool QgsSettingsEntryBase::copyValueFromKey ( const QString & key,
bool removeSettingAtKey = false ) const
inline

Copies the value from a given key if it exists.

Parameters
keythe key to copy the setting value from.
removeSettingAtKeyif true, the setting at the old key will be removed.
Returns
true if the key exists and the setting value could be copied.
Since
QGIS 3.30

Definition at line 379 of file qgssettingsentry.h.

◆ copyValueFromKey() [2/2]

bool QgsSettingsEntryBase::copyValueFromKey ( const QString & key,
const QStringList & dynamicKeyPartList,
bool removeSettingAtKey = false ) const

Copies the value from a given key if it exists.

Parameters
keythe key to copy the setting value from.
dynamicKeyPartListis the optional dynamic key part to determine the key. It must be the same for origin and destination keys.
removeSettingAtKeyif true, the setting at the old key will be removed.
Returns
true if the key exists and the setting value could be copied.
Since
QGIS 3.30

Definition at line 384 of file qgssettingsentry.cpp.

◆ copyValueToKey()

void QgsSettingsEntryBase::copyValueToKey ( const QString & key,
const QStringList & dynamicKeyPartList = QStringList() ) const

Copies the settings to the given key.

Parameters
keythe key to copy the setting value to.
dynamicKeyPartListis the optional dynamic key part to determine the key. It must be the same for origin and destination keys.
Since
QGIS 3.30

Definition at line 407 of file qgssettingsentry.cpp.

◆ copyValueToKeyIfChanged()

void QgsSettingsEntryBase::copyValueToKeyIfChanged ( const QString & key,
const QStringList & dynamicKeyPartList = QStringList() ) const

Copies the settings to the given key, if it has changed during the current QGIS session (see hasChanged()).

Parameters
keythe key to copy the setting value to.
dynamicKeyPartListis the optional dynamic key part to determine the key. It must be the same for origin and destination keys.
Since
QGIS 3.36

Definition at line 413 of file qgssettingsentry.cpp.

◆ defaultValueAsVariant()

QVariant QgsSettingsEntryBase::defaultValueAsVariant ( ) const

Returns settings default value.

Definition at line 362 of file qgssettingsentry.cpp.

◆ definitionKey()

QString QgsSettingsEntryBase::definitionKey ( ) const

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 key().

Definition at line 233 of file qgssettingsentry.cpp.

◆ description()

QString QgsSettingsEntryBase::description ( ) const

Returns the settings entry description.

Definition at line 367 of file qgssettingsentry.cpp.

◆ dynamicKeyPartToList()

QStringList QgsSettingsEntryBase::dynamicKeyPartToList ( const QString & dynamicKeyPart)
static

Transforms a dynamic key part string to list.

Since
QGIS 3.26

Definition at line 319 of file qgssettingsentry.cpp.

◆ exists() [1/2]

bool QgsSettingsEntryBase::exists ( const QString & dynamicKeyPart = QString()) const

Returns true if the settings is contained in the underlying QSettings.

Parameters
dynamicKeyPartspecifies the dynamic part of the settings key.

Definition at line 244 of file qgssettingsentry.cpp.

◆ exists() [2/2]

bool QgsSettingsEntryBase::exists ( const QStringList & dynamicKeyPartList) const

Returns true if the settings is contained in the underlying QSettings.

Parameters
dynamicKeyPartListspecifies the list of dynamic parts of the settings key.

Definition at line 250 of file qgssettingsentry.cpp.

◆ formerValueAsVariant() [1/2]

QVariant QgsSettingsEntryBase::formerValueAsVariant ( const QString & dynamicKeyPart) const

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.

Since
QGIS 3.26

Definition at line 372 of file qgssettingsentry.cpp.

◆ formerValueAsVariant() [2/2]

QVariant QgsSettingsEntryBase::formerValueAsVariant ( const QStringList & dynamicKeyPartList) const

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.

Since
QGIS 3.26

Definition at line 377 of file qgssettingsentry.cpp.

◆ globalChildGroups()

QStringList QgsSettingsEntryBase::globalChildGroups ( const QString & prefix)
static

Returns the list of child group names found under prefix in the global defaults hash.

The prefix is a tree-based key (may start with '/'). A trailing '/' is added automatically if not present.

Note
This is intended for internal use by QgsSettingsTreeNamedListNode.
Since
QGIS 4.2

Definition at line 110 of file qgssettingsentry.cpp.

◆ globalDefault()

QVariant QgsSettingsEntryBase::globalDefault ( const QString & key)
static

Returns the global default value for the given key, or an invalid QVariant if not found.

Since
QGIS 4.2

Definition at line 105 of file qgssettingsentry.cpp.

◆ hasChanged()

bool QgsSettingsEntryBase::hasChanged ( ) const
inline

Returns true if the setting was changed during the current QGIS session.

Since
QGIS 3.36

Definition at line 427 of file qgssettingsentry.h.

◆ hasDynamicKey()

bool QgsSettingsEntryBase::hasDynamicKey ( ) const

Returns true if a part of the settings key is built dynamically.

Definition at line 238 of file qgssettingsentry.cpp.

◆ hasGlobalDefault()

bool QgsSettingsEntryBase::hasGlobalDefault ( const QString & key)
static

Returns true if the global settings INI file contains a value for the given key.

Since
QGIS 4.2

Definition at line 100 of file qgssettingsentry.cpp.

◆ key() [1/2]

QString QgsSettingsEntryBase::key ( const QString & dynamicKeyPart = QString()) const

Returns settings entry key.

Parameters
dynamicKeyPartspecifies the dynamic part of the settings key.

Definition at line 180 of file qgssettingsentry.cpp.

◆ key() [2/2]

QString QgsSettingsEntryBase::key ( const QStringList & dynamicKeyPartList) const

Returns settings entry key.

Parameters
dynamicKeyPartListspecifies the list of dynamic parts of the settings key.

Definition at line 185 of file qgssettingsentry.cpp.

◆ keyIsValid()

bool QgsSettingsEntryBase::keyIsValid ( const QString & key) const

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"

Parameters
keyto check

Definition at line 217 of file qgssettingsentry.cpp.

◆ name()

QString QgsSettingsEntryBase::name ( ) const
inline

Returns the name of the settings.

Since
QGIS 3.30

Definition at line 204 of file qgssettingsentry.h.

◆ options()

Qgis::SettingsOptions QgsSettingsEntryBase::options ( ) const
inline

Returns the settings options.

Since
QGIS 3.26

Definition at line 247 of file qgssettingsentry.h.

◆ origin()

Qgis::SettingsOrigin QgsSettingsEntryBase::origin ( const QStringList & dynamicKeyPartList) const

Returns the origin of the setting if it exists.

Note
it will return Qgis::SettingsOrigin::Any if the key doesn't exist
Global takes precedence: if the key is defined in the global settings file, the origin is Qgis::SettingsOrigin::Global regardless of whether the user also overrides it.
Since
QGIS 3.30

Definition at line 256 of file qgssettingsentry.cpp.

◆ parent()

QgsSettingsTreeNode * QgsSettingsEntryBase::parent ( ) const
inline

Returns the parent tree element.

Since
QGIS 3.30

Definition at line 413 of file qgssettingsentry.h.

◆ remove() [1/2]

void QgsSettingsEntryBase::remove ( const QString & dynamicKeyPart = QString()) const

Removes the settings from the underlying QSettings.

Parameters
dynamicKeyPartspecifies the dynamic part of the settings key.

Definition at line 269 of file qgssettingsentry.cpp.

◆ remove() [2/2]

void QgsSettingsEntryBase::remove ( const QStringList & dynamicKeyPartList) const

Removes the settings from the underlying QSettings.

Parameters
dynamicKeyPartListspecifies the list of dynamic parts of the settings key.

Definition at line 274 of file qgssettingsentry.cpp.

◆ section()

int QgsSettingsEntryBase::section ( ) const

Returns settings section.

The settings section of the parent group is returned if available.

Deprecated
QGIS 3.26. The key is entirely self-defined.

Definition at line 279 of file qgssettingsentry.cpp.

◆ setGlobalSettingsPath()

bool QgsSettingsEntryBase::setGlobalSettingsPath ( const QString & path)
static

Sets the path to the global settings INI file and loads all keys into an in-memory hash for use as default values by QgsSettingsEntry.

This must be called once at application startup, before QgsApplication initialization, and only from the main thread.

Parameters
paththe path to the global settings INI file.
Returns
true if the file was successfully loaded, false if the path was empty or the file did not exist.
Since
QGIS 4.2

Definition at line 72 of file qgssettingsentry.cpp.

◆ settingsType()

virtual Qgis::SettingsType QgsSettingsEntryBase::settingsType ( ) const
inlinevirtual

Returns the settings entry type.

Reimplemented in QgsSettingsEntryBaseTemplate< T >, QgsSettingsEntryBaseTemplate< bool >, QgsSettingsEntryBaseTemplate< ColorTextFormat >, QgsSettingsEntryBaseTemplate< double >, QgsSettingsEntryBaseTemplate< ENUM >, QgsSettingsEntryBaseTemplate< FLAGS >, QgsSettingsEntryBaseTemplate< IdentifyMode >, QgsSettingsEntryBaseTemplate< int >, QgsSettingsEntryBaseTemplate< QColor >, QgsSettingsEntryBaseTemplate< Qgis::CadMeasurementDisplayType >, QgsSettingsEntryBaseTemplate< Qgis::DpiMode >, QgsSettingsEntryBaseTemplate< Qgis::EmbeddedScriptMode >, QgsSettingsEntryBaseTemplate< Qgis::EndCapStyle >, QgsSettingsEntryBaseTemplate< Qgis::GpsConnectionType >, QgsSettingsEntryBaseTemplate< Qgis::GpsInformationComponent >, QgsSettingsEntryBaseTemplate< Qgis::HttpMethod >, QgsSettingsEntryBaseTemplate< Qgis::JoinStyle >, QgsSettingsEntryBaseTemplate< Qgis::LayerTreeInsertionMethod >, QgsSettingsEntryBaseTemplate< Qgis::LegendSyncMode >, QgsSettingsEntryBaseTemplate< Qgis::MapToolUnit >, QgsSettingsEntryBaseTemplate< Qgis::ShadowQuality >, QgsSettingsEntryBaseTemplate< Qgis::SnappingMode >, QgsSettingsEntryBaseTemplate< Qgis::SnappingType >, QgsSettingsEntryBaseTemplate< Qgis::TextureFilterQuality >, QgsSettingsEntryBaseTemplate< Qgis::TilePixelRatio >, QgsSettingsEntryBaseTemplate< Qgis::UnknownLayerCrsBehavior >, QgsSettingsEntryBaseTemplate< Qgis::VectorRenderingSimplificationFlags >, QgsSettingsEntryBaseTemplate< Qgis::VectorSimplificationAlgorithm >, QgsSettingsEntryBaseTemplate< QgsAbstractGeometry::SegmentationToleranceType >, QgsSettingsEntryBaseTemplate< qlonglong >, QgsSettingsEntryBaseTemplate< QString >, QgsSettingsEntryBaseTemplate< QStringList >, QgsSettingsEntryBaseTemplate< Qt::TimeSpec >, QgsSettingsEntryBaseTemplate< QVariant >, QgsSettingsEntryBaseTemplate< QVariantMap >, QgsSettingsEntryBool, QgsSettingsEntryColor, QgsSettingsEntryDouble, QgsSettingsEntryEnumFlag< T >, QgsSettingsEntryEnumFlag< ColorTextFormat >, QgsSettingsEntryEnumFlag< ENUM >, QgsSettingsEntryEnumFlag< FLAGS >, QgsSettingsEntryEnumFlag< IdentifyMode >, QgsSettingsEntryEnumFlag< Qgis::CadMeasurementDisplayType >, QgsSettingsEntryEnumFlag< Qgis::DpiMode >, QgsSettingsEntryEnumFlag< Qgis::EmbeddedScriptMode >, QgsSettingsEntryEnumFlag< Qgis::EndCapStyle >, QgsSettingsEntryEnumFlag< Qgis::GpsConnectionType >, QgsSettingsEntryEnumFlag< Qgis::GpsInformationComponent >, QgsSettingsEntryEnumFlag< Qgis::HttpMethod >, QgsSettingsEntryEnumFlag< Qgis::JoinStyle >, QgsSettingsEntryEnumFlag< Qgis::LayerTreeInsertionMethod >, QgsSettingsEntryEnumFlag< Qgis::LegendSyncMode >, QgsSettingsEntryEnumFlag< Qgis::MapToolUnit >, QgsSettingsEntryEnumFlag< Qgis::ShadowQuality >, QgsSettingsEntryEnumFlag< Qgis::SnappingMode >, QgsSettingsEntryEnumFlag< Qgis::SnappingType >, QgsSettingsEntryEnumFlag< Qgis::TextureFilterQuality >, QgsSettingsEntryEnumFlag< Qgis::TilePixelRatio >, QgsSettingsEntryEnumFlag< Qgis::UnknownLayerCrsBehavior >, QgsSettingsEntryEnumFlag< Qgis::VectorRenderingSimplificationFlags >, QgsSettingsEntryEnumFlag< Qgis::VectorSimplificationAlgorithm >, QgsSettingsEntryEnumFlag< QgsAbstractGeometry::SegmentationToleranceType >, QgsSettingsEntryEnumFlag< Qt::TimeSpec >, QgsSettingsEntryInteger64, QgsSettingsEntryInteger, QgsSettingsEntryString, QgsSettingsEntryStringList, QgsSettingsEntryVariant, and QgsSettingsEntryVariantMap.

Definition at line 350 of file qgssettingsentry.h.

◆ setupUserSettings()

void QgsSettingsEntryBase::setupUserSettings ( const QString & profilePath)
static

Configures QSettings to use IniFormat at the given profilePath so that each thread's QSettings instance is recreated on next access with the correct format and path.

This is a convenience wrapper around QSettings::setDefaultFormat() and QSettings::setPath().

It should be called once at application startup, before QgsApplication initialization, and only from the main thread.

If called a second time, it will have no effect.

Since
QGIS 4.2

Definition at line 53 of file qgssettingsentry.cpp.

◆ setVariantValue() [1/2]

bool QgsSettingsEntryBase::setVariantValue ( const QVariant & value,
const QString & dynamicKeyPart = QString() ) const

Set settings value.

Parameters
valuespecifies the value to set.
dynamicKeyPartspecifies the dynamic part of the settings key.

Definition at line 284 of file qgssettingsentry.cpp.

◆ setVariantValue() [2/2]

bool QgsSettingsEntryBase::setVariantValue ( const QVariant & value,
const QStringList & dynamicKeyPartList ) const

Set settings value.

This should be called from any implementation as it takes care of actually calling QSettings

Parameters
valuespecifies the value to set.
dynamicKeyPartListspecifies the list of dynamic parts of the settings key.

Definition at line 289 of file qgssettingsentry.cpp.

◆ typeId()

QString QgsSettingsEntryBase::typeId ( ) const
virtual

Returns the id of the type of settings This can be re-implemented in a custom implementation of a setting.

Since
QGIS 3.32

Reimplemented in QgsSettingsEntryEnumFlag< T >, QgsSettingsEntryEnumFlag< ColorTextFormat >, QgsSettingsEntryEnumFlag< ENUM >, QgsSettingsEntryEnumFlag< FLAGS >, QgsSettingsEntryEnumFlag< IdentifyMode >, QgsSettingsEntryEnumFlag< Qgis::CadMeasurementDisplayType >, QgsSettingsEntryEnumFlag< Qgis::DpiMode >, QgsSettingsEntryEnumFlag< Qgis::EmbeddedScriptMode >, QgsSettingsEntryEnumFlag< Qgis::EndCapStyle >, QgsSettingsEntryEnumFlag< Qgis::GpsConnectionType >, QgsSettingsEntryEnumFlag< Qgis::GpsInformationComponent >, QgsSettingsEntryEnumFlag< Qgis::HttpMethod >, QgsSettingsEntryEnumFlag< Qgis::JoinStyle >, QgsSettingsEntryEnumFlag< Qgis::LayerTreeInsertionMethod >, QgsSettingsEntryEnumFlag< Qgis::LegendSyncMode >, QgsSettingsEntryEnumFlag< Qgis::MapToolUnit >, QgsSettingsEntryEnumFlag< Qgis::ShadowQuality >, QgsSettingsEntryEnumFlag< Qgis::SnappingMode >, QgsSettingsEntryEnumFlag< Qgis::SnappingType >, QgsSettingsEntryEnumFlag< Qgis::TextureFilterQuality >, QgsSettingsEntryEnumFlag< Qgis::TilePixelRatio >, QgsSettingsEntryEnumFlag< Qgis::UnknownLayerCrsBehavior >, QgsSettingsEntryEnumFlag< Qgis::VectorRenderingSimplificationFlags >, QgsSettingsEntryEnumFlag< Qgis::VectorSimplificationAlgorithm >, QgsSettingsEntryEnumFlag< QgsAbstractGeometry::SegmentationToleranceType >, and QgsSettingsEntryEnumFlag< Qt::TimeSpec >.

Definition at line 174 of file qgssettingsentry.cpp.

◆ userSettings()

QSettings & QgsSettingsEntryBase::userSettings ( )
static

Returns a reference to the thread-local QSettings instance used internally by all QgsSettingsEntry operations.

Note
This is intended for internal use by the settings framework (e.g. QgsSettingsTreeNamedListNode). Prefer using QgsSettingsEntry accessors instead.
Since
QGIS 4.2

Definition at line 65 of file qgssettingsentry.cpp.

◆ valueAsVariant() [1/4]

QVariant QgsSettingsEntryBase::valueAsVariant ( const QString & dynamicKeyPart,
bool useDefaultValueOverride,
const QVariant & defaultValueOverride ) const

Returns settings value with an optional default value override.

Deprecated
QGIS 3.26. Use valueAsVariantWithDefaultOverride() instead.

Definition at line 337 of file qgssettingsentry.cpp.

◆ valueAsVariant() [2/4]

QVariant QgsSettingsEntryBase::valueAsVariant ( const QString & dynamicKeyPart = QString()) const

Returns settings value with.

Parameters
dynamicKeyPartspecifying the dynamic part of the settings key.

Definition at line 327 of file qgssettingsentry.cpp.

◆ valueAsVariant() [3/4]

QVariant QgsSettingsEntryBase::valueAsVariant ( const QStringList & dynamicKeyPartList) const

Returns settings value with.

Parameters
dynamicKeyPartListspecifying the dynamic part of the settings key.

Definition at line 332 of file qgssettingsentry.cpp.

◆ valueAsVariant() [4/4]

QVariant QgsSettingsEntryBase::valueAsVariant ( const QStringList & dynamicKeyPartList,
bool useDefaultValueOverride,
const QVariant & defaultValueOverride ) const

Returns settings value with an optional default value override.

Deprecated
QGIS 3.26. Use valueAsVariantWithDefaultOverride() instead.

Definition at line 344 of file qgssettingsentry.cpp.

◆ valueAsVariantWithDefaultOverride() [1/2]

QVariant QgsSettingsEntryBase::valueAsVariantWithDefaultOverride ( const QVariant & defaultValueOverride,
const QString & dynamicKeyPart = QString() ) const

Returns settings value with a defaultValueOverride.

Since
QGIS 3.26

Definition at line 352 of file qgssettingsentry.cpp.

◆ valueAsVariantWithDefaultOverride() [2/2]

QVariant QgsSettingsEntryBase::valueAsVariantWithDefaultOverride ( const QVariant & defaultValueOverride,
const QStringList & dynamicKeyPartList ) const

Returns settings value.

Parameters
dynamicKeyPartListspecifies the list of dynamic parts of the settings key.
defaultValueOverrideif valid is used instead of the normal default value.
Since
QGIS 3.26

Definition at line 357 of file qgssettingsentry.cpp.


The documentation for this class was generated from the following files: