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.

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

keys(self) → List[str]

Returns list of stored keys

Return type

List[str]

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

Read store contents from XML

Parameters
  • parentNode (QDomNode) – node to read from

  • keyStartsWith (str = '') – 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

Parameters

key (str) –

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

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

Parameters
  • key (str) –

  • value (Any) –

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

Parameters
  • key (str) –

  • defaultValue (Any = None) –

Return type

Any

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

Write store contents to XML

Parameters
  • parentNode (QDomNode) –

  • doc (QDomDocument) –