Class: QgsSettingsEntryString

A string settings entry.

Added in version 3.20.

Class Hierarchy

Inheritance diagram of qgis.core.QgsSettingsEntryString

Base classes

QgsSettingsEntryBaseTemplateQStringBase

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

maxLength

Returns the string maximum length.

minLength

Returns the string minimum length.

class qgis.core.QgsSettingsEntryString[source]

Bases: QgsSettingsEntryBaseTemplateQStringBase

__init__(name: str | None, parent: QgsSettingsTreeNode | None, defaultValue: str | None = '', description: str | None = '', options: Qgis.SettingsOptions | Qgis.SettingsOption = Qgis.SettingsOptions(), minLength: int = 0, maxLength: int = -1)

Constructor for QgsSettingsEntryString.

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

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

  • defaultValue (Optional[str] = '') – 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.

  • minLength (int = 0) – specifies the minimal length of the string value. 0 means no limit.

  • maxLength (int = -1) – specifies the maximal length of the string value. -1 means no limit.

__init__(key: str | None, pluginName: str | None, defaultValue: str | None = '', description: str | None = '', options: Qgis.SettingsOptions | Qgis.SettingsOption = Qgis.SettingsOptions(), minLength: int = 0, maxLength: int = -1)

Constructor for QgsSettingsEntryString. 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 (Optional[str] = '') – 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.

  • minLength (int = 0)

  • maxLength (int = -1)

__init__(a0: QgsSettingsEntryString)
Parameters:

a0 (QgsSettingsEntryString)

maxLength(self) int[source]

Returns the string maximum length. By -1 there is no limitation.

Return type:

int

minLength(self) int[source]

Returns the string minimum length.

Return type:

int