Class: QgsSettingsEntryString¶
- class qgis.core.QgsSettingsEntryString¶
Bases:
QgsSettingsEntryByReferenceQStringBase
A string settings entry.
New in version 3.20.
QgsSettingsEntryString(key: str, pluginName: str, defaultValue: str = ‘’, description: str = ‘’, options: Union[Qgis.SettingsOptions, Qgis.SettingsOption] = Qgis.SettingsOptions(), minLength: int = 0, maxLength: int = -1) Constructor for QgsSettingsEntryString. This constructor is intended to be used from plugins.
The
key
argument specifies the key of the settings. ThepluginName
argument is inserted in the key after the section. ThedefaultValue
argument specifies the default value for the settings entry. Thedescription
argument specifies a description for the settings entry. Theoptions
arguments specifies the options for the settings entry.QgsSettingsEntryString(
QgsSettingsEntryString
)Methods
Check if the value is valid
Converts the variant value to the value type of the setting
Converts the value to a variant
Returns the string maximum length.
Returns the string minimum length.
Set the string maximum length.
Set the string minimum length.
Sets the settings value with an optional list of dynamic parts
Sets the settings value with a variant value.
- rtype
Qgis.SettingsType
- checkValue(self, value: str) bool ¶
Check if the value is valid
- convertFromVariant(self, value: Any) str ¶
Converts the variant value to the value type of the setting
- convertToVariant(self, value: str) Any ¶
Converts the value to a variant
- maxLength(self) int ¶
Returns the string maximum length. By -1 there is no limitation.
- Return type
int
- minLength(self) int ¶
Returns the string minimum length.
- Return type
int
- setMaxLength(self, maxLength: int)¶
Set the string maximum length.
maxLength The string maximum length.
- Parameters
maxLength (int) –
- setMinLength(self, minLength: int)¶
Set the string minimum length.
minLength The string minimum length.
- Parameters
minLength (int) –
- setValuePrivate(self, value: str, dynamicKeyPartList: Iterable[str]) bool ¶
Sets the settings value with an optional list of dynamic parts
- setVariantValuePrivate(self, value: Any, dynamicKeyPartList: Iterable[str] = []) bool ¶
Sets the settings value with a variant value. This should be called from any implementation as it takes care of actually calling QSettings
New in version 3.26.
- settingsType(self) Qgis.SettingsType ¶
- Return type