QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | List of all members
QgsProjectPropertyValue Class Reference

Project property value node, contains a QgsProjectPropertyKey's value. More...

#include <qgsprojectproperty.h>

Inheritance diagram for QgsProjectPropertyValue:
Inheritance graph
[legend]

Public Member Functions

 QgsProjectPropertyValue ()=default
 Constructor for QgsProjectPropertyValue. More...
 
 QgsProjectPropertyValue (const QVariant &value)
 Constructor for QgsProjectPropertyValue, initialized to a specified value. More...
 
void dump (int tabs=0) const override
 Dumps out the keys and values. More...
 
bool isKey () const override
 Returns true if the property is a QgsProjectPropertyKey. More...
 
bool isLeaf () const override
 Returns true if property is a leaf node. More...
 
bool isValue () const override
 Returns true if the property is a QgsProjectPropertyValue. More...
 
bool readXml (const QDomNode &keyNode) override
 Restores the property hierarchy from a specified DOM node. More...
 
QVariant value () const override
 Returns the node's value. More...
 
bool writeXml (const QString &nodeName, QDomElement &element, QDomDocument &document) override
 Writes the property hierarchy to a specified DOM element. More...
 
- Public Member Functions inherited from QgsProjectProperty
 QgsProjectProperty ()
 
virtual ~QgsProjectProperty ()=default
 
virtual void dump (int tabs=0) const =0
 Dumps out the keys and values. More...
 
virtual bool isKey () const =0
 Returns true if the property is a QgsProjectPropertyKey. More...
 
virtual bool isLeaf () const =0
 Returns true if property is a leaf node. More...
 
virtual bool isValue () const =0
 Returns true if the property is a QgsProjectPropertyValue. More...
 
virtual bool readXml (const QDomNode &keyNode)=0
 Restores the property hierarchy from a specified DOM node. More...
 
virtual QVariant value () const =0
 Returns the node's value. More...
 
virtual bool writeXml (const QString &nodeName, QDomElement &element, QDomDocument &document)=0
 Writes the property hierarchy to a specified DOM element. More...
 

Detailed Description

Project property value node, contains a QgsProjectPropertyKey's value.

Definition at line 126 of file qgsprojectproperty.h.

Constructor & Destructor Documentation

◆ QgsProjectPropertyValue() [1/2]

QgsProjectPropertyValue::QgsProjectPropertyValue ( )
default

Constructor for QgsProjectPropertyValue.

◆ QgsProjectPropertyValue() [2/2]

QgsProjectPropertyValue::QgsProjectPropertyValue ( const QVariant &  value)
inline

Constructor for QgsProjectPropertyValue, initialized to a specified value.

Definition at line 136 of file qgsprojectproperty.h.

Member Function Documentation

◆ dump()

void QgsProjectPropertyValue::dump ( int  tabs = 0) const
overridevirtual

Dumps out the keys and values.

Parameters
tabsis number of tabs to print; used for pretty-printing hierarchy

Implements QgsProjectProperty.

Definition at line 30 of file qgsprojectproperty.cpp.

◆ isKey()

bool QgsProjectPropertyValue::isKey ( ) const
inlineoverridevirtual

Returns true if the property is a QgsProjectPropertyKey.

See also
isValue()
isLeaf()

Implements QgsProjectProperty.

Definition at line 140 of file qgsprojectproperty.h.

◆ isLeaf()

bool QgsProjectPropertyValue::isLeaf ( ) const
inlineoverridevirtual

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.

Implements QgsProjectProperty.

Definition at line 145 of file qgsprojectproperty.h.

◆ isValue()

bool QgsProjectPropertyValue::isValue ( ) const
inlineoverridevirtual

Returns true if the property is a QgsProjectPropertyValue.

See also
isKey()
isLeaf()

Implements QgsProjectProperty.

Definition at line 141 of file qgsprojectproperty.h.

◆ readXml()

bool QgsProjectPropertyValue::readXml ( const QDomNode &  keyNode)
overridevirtual

Restores the property hierarchy from a specified DOM node.

Used for restoring properties from project file

Implements QgsProjectProperty.

Definition at line 54 of file qgsprojectproperty.cpp.

◆ value()

QVariant QgsProjectPropertyValue::value ( ) const
inlineoverridevirtual

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.

Implements QgsProjectProperty.

Definition at line 142 of file qgsprojectproperty.h.

◆ writeXml()

bool QgsProjectPropertyValue::writeXml ( const QString &  nodeName,
QDomElement &  element,
QDomDocument &  document 
)
overridevirtual

Writes the property hierarchy to a specified DOM element.

Used for saving properties to project file.

Parameters
nodeNamethe tag name associated with this element
elementthe parent (or encompassing) property element
documentthe overall project file Dom document

Implements QgsProjectProperty.

Definition at line 231 of file qgsprojectproperty.cpp.


The documentation for this class was generated from the following files: