Class: 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.

Class Hierarchy

Inheritance diagram of qgis.core.QgsProjectPropertyKey

Base classes

QgsProjectProperty

An Abstract Base Class for QGIS project property hierarchys.

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.

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.

name

The name of the property is used as identifier.

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

class qgis.core.QgsProjectPropertyKey[source]

Bases: QgsProjectProperty

__init__(name: str | None = '')

Create a new QgsProjectPropertyKey with the specified identifier.

Parameters:

name (Optional[str] = '')

__init__(a0: QgsProjectPropertyKey)
Parameters:

a0 (QgsProjectPropertyKey)

addKey(self, keyName: str | None) QgsProjectPropertyKey | None[source]

Adds the specified property key as a sub-key.

Parameters:

keyName (Optional[str])

Return type:

Optional[QgsProjectPropertyKey]

clear(self)[source]

Resets the property to a default, empty state.

clearKeys(self)[source]

Deletes any sub-nodes from the property.

count(self) int[source]

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

Return type:

int

entryList(self, entries: Iterable[str | None])[source]

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

See also

subkeyList()

Parameters:

entries (Iterable[Optional[str]])

find(self, propertyName: str | None) QgsProjectProperty | None[source]

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

Parameters:

propertyName (Optional[str])

Return type:

Optional[QgsProjectProperty]

isEmpty(self) bool[source]

Returns True if this property contains no sub-keys.

Return type:

bool

name(self) str[source]

The name of the property is used as identifier.

See also

setName()

Return type:

str

removeKey(self, keyName: str | None)[source]

Removes the specified key.

Parameters:

keyName (Optional[str])

setName(self, name: str | None)[source]

The name of the property is used as identifier.

See also

name()

Parameters:

name (Optional[str])

setValue(self, name: str | None, value: Any) QgsProjectPropertyValue | None[source]

Sets the value associated with this key.

Parameters:
  • name (Optional[str]) – is the key name

  • value (Any) – is the value to set

Return type:

Optional[QgsProjectPropertyValue]

Returns:

pointer to property value

setValue(self, value: Any) QgsProjectPropertyValue | None[source]

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

Parameters:

value (Any)

Return type:

Optional[QgsProjectPropertyValue]

subkeyList(self, entries: Iterable[str | None])[source]

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

See also

entryList()

Parameters:

entries (Iterable[Optional[str]])

value(self) Any[source]

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

Return type:

Any