QgsProjectPropertyValue class
Project property value node, contains a QgsProjectPropertyKey's value.
Contents
Base classes
- class QgsProjectProperty
- An Abstract Base Class for QGIS project property hierarchys.
Constructors, destructors, conversion operators
- QgsProjectPropertyValue() defaulted
- Constructor for QgsProjectPropertyValue.
- QgsProjectPropertyValue(const QVariant& value)
- Constructor for QgsProjectPropertyValue, initialized to a specified value.
Public functions
- void dump(int tabs = 0) const override
- Dumps out the keys and values.
- auto isKey() const -> bool override
- Returns true if the property is a QgsProjectPropertyKey.
- auto isLeaf() const -> bool override
- Returns true if property is a leaf node.
- auto isValue() const -> bool override
- Returns true if the property is a QgsProjectPropertyValue.
- auto readXml(const QDomNode& keyNode) -> bool override
- Restores the property hierarchy from a specified DOM node.
- auto value() const -> QVariant override
- Returns the node's value.
- auto writeXml(const QString& nodeName, QDomElement& element, QDomDocument& document) -> bool override
- Writes the property hierarchy to a specified DOM element.
Function documentation
void QgsProjectPropertyValue:: dump(int tabs = 0) const override
Dumps out the keys and values.
| Parameters | |
|---|---|
| tabs | is number of tabs to print; used for pretty-printing hierarchy |
bool QgsProjectPropertyValue:: isKey() const override
Returns true if the property is a QgsProjectPropertyKey.
bool QgsProjectPropertyValue:: isLeaf() const override
Returns true if property is a leaf node.
A leaf node is a key node that has either no value or only a single value. A non-leaf node would be a key node with key sub-nodes.
This is used for entryList() and subkeyList() implementation.
bool QgsProjectPropertyValue:: isValue() const override
Returns true if the property is a QgsProjectPropertyValue.
bool QgsProjectPropertyValue:: readXml(const QDomNode& keyNode) override
Restores the property hierarchy from a specified DOM node.
Used for restoring properties from project file
QVariant QgsProjectPropertyValue:: value() const override
Returns the node's value.
For QgsProjectPropertyValue nodes, this is straightforward – just return the embedded QVariant, _value. For QgsProjectPropertyKey, this means returning the QgsProjectPropertyValue _value that is keyed by its name, if it exists; i.e., QgsProjectPropertyKey "foo" will return the property value mapped to its name, "foo", in its QHash of QProperties.
bool QgsProjectPropertyValue:: writeXml(const QString& nodeName,
QDomElement& element,
QDomDocument& document) override
Writes the property hierarchy to a specified DOM element.
| Parameters | |
|---|---|
| nodeName | the tag name associated with this element |
| element | the parent (or encompassing) property element |
| document | the overall project file Dom document |
Used for saving properties to project file.