Class: QgsProjectPropertyKey

class qgis.core.QgsProjectPropertyKey(name: str = '')

Bases: qgis._core.QgsProjectProperty

Create a new QgsProjectPropertyKey with the specified identifier.

QgsProjectPropertyKey(QgsProjectPropertyKey)

Project property key node.

Can, itself, contain QgsProjectPropertyKey and QgsProjectPropertyValues.

The internal QHash, mProperties, maps key names to their respective QgsProjectPropertyValue or next QgsProjectPropertyKey in the key name sequence. The key with the current name should contain its QgsProjectPropertyValue.

E.g., given the key sequence “/foo/bar”, “foo” will have a corresponding QgsProjectPropertyKey with a name “foo”. It will contain an element in its mProperties that maps to “bar”, which is another QgsProjectPropertyKey. The “bar” QgsProjectPropertyKey will, in turn, have an element that maps to itself, i.e. “bar”, that will contain a QgsProjectPropertyValue.

New in version 3.0: Methods

addKey Adds the specified property key as a sub-key.
clear Resets the property to a default, empty state.
clearKeys Deletes any sub-nodes from the property.
count Returns the number of sub-keys contained by this property.
dump
entryList Returns any sub-keys contained by this property that do not contain other keys.
find Attempts to find a property with a matching sub-key name.
isEmpty Returns true if this property contains no sub-keys.
isKey
isLeaf
isValue
name The name of the property is used as identifier.
readXml
removeKey Removes the specified key.
setName The name of the property is used as identifier.
setValue Sets the value associated with this key.
subkeyList Returns any sub-keys contained by this property which themselves contain other keys.
value If this key has a value, it will be stored by its name in its properties
writeXml

Signals

Attributes

addKey(self, keyName: str) → QgsProjectPropertyKey

Adds the specified property key as a sub-key.

clear(self)

Resets the property to a default, empty state.

clearKeys(self)

Deletes any sub-nodes from the property.

count(self) → int

Returns the number of sub-keys contained by this property.

dump(self, tabs: int = 0)
entryList(self, entries: Iterable[str])

Returns any sub-keys contained by this property that do not contain other keys.

See also

subkeyList()

find(self, propertyName: str) → QgsProjectProperty

Attempts to find a property with a matching sub-key name.

isEmpty(self) → bool

Returns true if this property contains no sub-keys.

isKey(self) → bool
isLeaf(self) → bool
isValue(self) → bool
name(self) → str

The name of the property is used as identifier.

See also

setName()

readXml(self, keyNode: QDomNode) → bool
removeKey(self, keyName: str)

Removes the specified key.

setName(self, name: str)

The name of the property is used as identifier.

See also

name()

New in version 3.0.

setValue(self, name: str, value: Any) → QgsProjectPropertyValue

Sets the value associated with this key.

Parameters:
  • name – is the key name
  • value – is the value to set
Returns:

pointer to property value

setValue(self, value: Any) -> QgsProjectPropertyValue Set the value associated with this key

Note

that the single value node associated with each key is always stored keyed by the current key name

subkeyList(self, entries: Iterable[str])

Returns any sub-keys contained by this property which themselves contain other keys.

See also

entryList()

value(self) → Any

If this key has a value, it will be stored by its name in its properties

writeXml(self, nodeName: str, element: QDomElement, document: QDomDocument) → bool