Class: QgsObjectCustomProperties¶
- class qgis.core.QgsObjectCustomProperties¶
Bases:
sip.wrapper
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML in verbatim <customproperties> endverbatim element.
QgsObjectCustomProperties() Constructor for QgsObjectCustomProperties.
QgsObjectCustomProperties(
QgsObjectCustomProperties
)Methods
Returns
True
if the properties contains akey
with the specified name.Returns a list of all stored keys.
Read store contents from an XML node.
Removes a
key
(entry) from the store.Add an entry to the store with the specified
key
.Returns the value for the given
key
.Writes the store contents to an XML node.
- contains(self, key: str) bool ¶
Returns
True
if the properties contains akey
with the specified name.Added in version 3.14.
- Parameters:
key (str)
- Return type:
bool
- keys(self) List[str] ¶
Returns a list of all stored keys.
- Return type:
List[str]
- readXml(self, parentNode: QDomNode, keyStartsWith: str = '')¶
Read store contents from an XML node.
- Parameters:
parentNode (QDomNode) – node to read from
keyStartsWith (str = '') – reads only properties starting with the specified string (or all if the string is empty)
See also
- remove(self, key: str)¶
Removes a
key
(entry) from the store.- Parameters:
key (str)
- setValue(self, key: str, value: Any)¶
Add an entry to the store with the specified
key
.If an entry with the same
key
exists already, it will be overwritten.- Parameters:
key (str)
value (Any)
- value(self, key: str, defaultValue: Any = None) Any ¶
Returns the value for the given
key
.If the
key
is not present in the properties, thedefaultValue
will be returned.- Parameters:
key (str)
defaultValue (Any = None)
- Return type:
Any