Class: QgsObjectCustomProperties

class qgis.core.QgsObjectCustomProperties

Bases: sip.wrapper

Constructor for QgsObjectCustomProperties.

QgsObjectCustomProperties(QgsObjectCustomProperties)

Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML in verbatim <customproperties> endverbatim element.

New in version 2.4: Methods

keys Returns list of stored keys
readXml Read store contents from XML
remove Remove a key (entry) from the store
setValue Add an entry to the store.
value Returns value for the given key.
writeXml Write store contents to XML

Signals

Attributes

keys(self) → List[str]

Returns list of stored keys

readXml(self, parentNode: QDomNode, keyStartsWith: str = '')

Read store contents from XML

Parameters:
  • parentNode – node to read from
  • keyStartsWith – reads only properties starting with the specified string (or all if the string is empty)
remove(self, key: str)

Remove a key (entry) from the store

setValue(self, key: str, value: Any)

Add an entry to the store. If the entry with the keys exists already, it will be overwritten

value(self, key: str, defaultValue: Any = None) → Any

Returns value for the given key. If the key is not stored, default value will be used

writeXml(self, parentNode: QDomNode, doc: QDomDocument)

Write store contents to XML