Class: QgsSettingsEntryVariant

A variant settings entry.

Added in version 3.20.

Class Hierarchy

Inheritance diagram of qgis.core.QgsSettingsEntryVariant

Base classes

QgsSettingsEntryBaseTemplateQVariantBase

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

QgsSettingsEntryBase

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.

Methods

valueAs

Returns settings value.

class qgis.core.QgsSettingsEntryVariant[source]

Bases: QgsSettingsEntryBaseTemplateQVariantBase

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

Constructor for QgsSettingsEntryVariant.

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

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

  • defaultValue (Any = None) – 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.

Added in version 3.30.

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

Constructor for QgsSettingsEntryVariant. This constructor is intended to be used from plugins.

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

  • pluginName (Optional[str]) – is inserted in the key after the section.

  • defaultValue (Any = None) – 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: QgsSettingsEntryVariant)
Parameters:

a0 (QgsSettingsEntryVariant)

valueAs(self, type: Any) Any[source]

Returns settings value.

Parameters:

type (Any) – is the Python type of the value to be returned

Return type:

Any