QgsProjectProperty class
An Abstract Base Class for QGIS project property hierarchys.
Contents
- Reference
Each sub-class is either a QgsProjectPropertyKey or QgsProjectPropertyValue. QgsProjectPropertyKey can contain either QgsProjectPropertyKey or QgsProjectPropertyValues, thus describing an hierarchy. QgsProjectPropertyValues are always graph leaves.
Derived classes
- class QgsProjectPropertyKey
- Project property key node.
- class QgsProjectPropertyValue
- Project property value node, contains a QgsProjectPropertyKey's value.
Public functions
- void dump(int tabs = 0) const pure virtual
- Dumps out the keys and values.
- auto isKey() const -> bool pure virtual
- Returns true if the property is a QgsProjectPropertyKey.
- auto isLeaf() const -> bool pure virtual
- Returns true if property is a leaf node.
- auto isValue() const -> bool pure virtual
- Returns true if the property is a QgsProjectPropertyValue.
- auto readXml(const QDomNode& keyNode) -> bool pure virtual
- Restores the property hierarchy from a specified DOM node.
- auto value() const -> QVariant pure virtual
- Returns the node's value.
- auto writeXml(const QString& nodeName, QDomElement& element, QDomDocument& document) -> bool pure virtual
- Writes the property hierarchy to a specified DOM element.
Function documentation
void QgsProjectProperty:: dump(int tabs = 0) const pure virtual
Dumps out the keys and values.
| Parameters | |
|---|---|
| tabs | is number of tabs to print; used for pretty-printing hierarchy |
bool QgsProjectProperty:: isKey() const pure virtual
Returns true if the property is a QgsProjectPropertyKey.
bool QgsProjectProperty:: isLeaf() const pure virtual
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 QgsProjectProperty:: isValue() const pure virtual
Returns true if the property is a QgsProjectPropertyValue.
bool QgsProjectProperty:: readXml(const QDomNode& keyNode) pure virtual
Restores the property hierarchy from a specified DOM node.
Used for restoring properties from project file
QVariant QgsProjectProperty:: value() const pure virtual
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 QgsProjectProperty:: writeXml(const QString& nodeName,
QDomElement& element,
QDomDocument& document) pure virtual
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.