Class: QgsSettingsEntryBaseTemplateQStringBase

Base abstract class for settings entries with typed get and set methods.

Added in version 3.32.

Class Hierarchy

Inheritance diagram of qgis.core.QgsSettingsEntryBaseTemplateQStringBase

Base classes

QgsSettingsEntryBase

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

Subclasses

QgsSettingsEntryString

A string settings entry.

class qgis.core.QgsSettingsEntryBaseTemplateQStringBase

Bases: QgsSettingsEntryBase

__init__(name: str | None, parent: QgsSettingsTreeNode | None, defaultValue: Any, description: str | None = '', options: Qgis.SettingsOptions | Qgis.SettingsOption = Qgis.SettingsOptions())

Constructor for QgsSettingsEntryByReference.

Parameters:
  • name (Optional[str]) – specifies the key of the settings.

  • parent (Optional[QgsSettingsTreeNode]) – specifies the parent in the tree of settings.

  • defaultValue (Any) – specifies the default value for the settings entry.

  • description (Optional[str] = '') – specifies a description for the settings entry.

  • options (Union[Qgis.SettingsOptions, Qgis.SettingsOption] = Qgis.SettingsOptions()) – specifies the options for the settings entry.

Raises:

QgsSettingsException – if the number of given parent named items doesn’t match the complete key definition

Added in version 3.30.

__init__(key: str | None, section: str | None, defaultValue: Any, description: str | None = '', options: Qgis.SettingsOptions | Qgis.SettingsOption = Qgis.SettingsOptions())

Constructor for QgsSettingsEntryByReference.

Parameters:
  • key (Optional[str]) – specifies the key of the settings.

  • section (Optional[str]) – specifies the section.

  • defaultValue (Any) – specifies the default value for the settings entry.

  • description (Optional[str] = '') – specifies a description for the settings entry.

  • options (Union[Qgis.SettingsOptions, Qgis.SettingsOption] = Qgis.SettingsOptions()) – specifies the options for the settings entry.

__init__(a0: QgsSettingsEntryBaseTemplateQStringBase)
Parameters:

a0 (QgsSettingsEntryBaseTemplateQStringBase)

checkValuePrivate(self, value: str | None) bool

Check if the value is valid

Parameters:

value (Optional[str])

Return type:

bool

convertFromVariant(self, value: Any) str

Converts the variant value to the value type of the setting

Parameters:

value (Any)

Return type:

str

convertToVariant(self, value: str | None) Any

Converts the value to a variant

Parameters:

value (Optional[str])

Return type:

Any

defaultValue(self) str

Returns settings default value.

Return type:

str

formerValue(self, dynamicKeyPart: str | None = '') str

Returns the former value. Returns the current value (or default) if there is no former value.

formerValue(self, dynamicKeyPartList: Iterable[Optional[str]]) -> str Returns the former value Returns the current value (or default) if there is no former value.

Parameters:

dynamicKeyPart (Optional[str] = '')

Return type:

str

setValue(self, value: str | None, dynamicKeyPart: str | None = '') bool

Set settings value.

Parameters:
  • value (Optional[str]) – specifies the value to set.

  • dynamicKeyPart (Optional[str] = '') – specifies the dynamic part of the settings key.

setValue(self, value: Optional[str], dynamicKeyPartList: Iterable[Optional[str]]) -> bool Set settings value.

Parameters:
  • value – specifies the value to set.

  • dynamicKeyPartList – specifies the list of dynamic parts of the settings key.

Return type:

bool

setValuePrivate(self, value: str | None, dynamicKeyPartList: Iterable[str | None]) bool

Sets the settings value with an optional list of dynamic parts

Parameters:
  • value (Optional[str])

  • dynamicKeyPartList (Iterable[Optional[str]])

Return type:

bool

value(self, dynamicKeyPart: str | None = '') str

Returns settings value.

Parameters:

dynamicKeyPart (Optional[str] = '') – specifies the dynamic part of the settings key.

value(self, dynamicKeyPartList: Iterable[Optional[str]]) -> str Returns settings value.

Parameters:

dynamicKeyPartList – specifies the list of dynamic parts of the settings key.

Return type:

str

valueWithDefaultOverride(self, defaultValueOverride: str | None, dynamicKeyPart: str | None = '') str

Returns the settings value with a defaultValueOverride and with an optional dynamicKeyPart

valueWithDefaultOverride(self, defaultValueOverride: Optional[str], dynamicKeyPartList: Iterable[Optional[str]]) -> str Returns the settings value with a defaultValueOverride for the dynamicKeyPartList

Parameters:
  • defaultValueOverride (Optional[str])

  • dynamicKeyPart (Optional[str] = '')

Return type:

str