QGIS API Documentation  2.99.0-Master (f59acad)
Public Member Functions | List of all members
QgsPropertyKey Class Reference

QgsPropertyKey node. More...

#include <qgsprojectproperty.h>

Inheritance diagram for QgsPropertyKey:
Inheritance graph
[legend]

Public Member Functions

 QgsPropertyKey (const QString &name=QString())
 Create a new QgsPropertyKey with the specified identifier. More...
 
virtual ~QgsPropertyKey ()
 
QgsPropertyKeyaddKey (const QString &keyName)
 add the given property key More...
 
virtual void clear ()
 reset the QgsProperty key to prestine state More...
 
virtual void clearKeys ()
 delete any sub-nodes More...
 
int count () const
 how many elements are contained within this one? More...
 
void dump (int tabs=0) const override
 Dumps out the keys and values. More...
 
void entryList (QStringList &entries) const
 return keys that do not contain other keys More...
 
QgsPropertyfind (QString &propertyName)
 
bool isEmpty () const
 Does this property not have any subkeys or values? More...
 
virtual bool isKey () const override
 Returns true if is a QgsPropertyKey. More...
 
bool isLeaf () const override
 Returns true if a leaf node A leaf node is a key node that has either no value or a single value. More...
 
virtual bool isValue () const override
 Returns true if is a QgsPropertyValue. More...
 
QString name () const
 The name of the property is used as identifier. More...
 
bool readXml (QDomNode &keyNode) override
 restores property hierarchy to given Dom node More...
 
void removeKey (const QString &keyName)
 remove the given key More...
 
void setName (const QString &name)
 The name of the property is used as identifier. More...
 
QgsPropertyValuesetValue (const QString &name, const QVariant &value)
 Set the value associated with this key. More...
 
QgsPropertyValuesetValue (const QVariant &value)
 Set the value associated with this key. More...
 
void subkeyList (QStringList &entries) const
 return keys that contain other keys More...
 
QVariant value () const override
 If this key has a value, it will be stored by its name in its properties. More...
 
bool writeXml (const QString &nodeName, QDomElement &element, QDomDocument &document) override
 Property keys will always create a Dom element for itself and then recursively call writeXml for any constituent properties. More...
 
- Public Member Functions inherited from QgsProperty
 QgsProperty ()
 
virtual ~QgsProperty ()=default
 

Detailed Description

QgsPropertyKey node.

Can, itself, contain QgsPropertyKeys and QgsPropertyValues.

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

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

Definition at line 183 of file qgsprojectproperty.h.

Constructor & Destructor Documentation

§ QgsPropertyKey()

QgsPropertyKey::QgsPropertyKey ( const QString &  name = QString())

Create a new QgsPropertyKey with the specified identifier.

Definition at line 271 of file qgsprojectproperty.cpp.

§ ~QgsPropertyKey()

QgsPropertyKey::~QgsPropertyKey ( )
virtual

Definition at line 275 of file qgsprojectproperty.cpp.

Member Function Documentation

§ addKey()

QgsPropertyKey* QgsPropertyKey::addKey ( const QString &  keyName)
inline

add the given property key

Definition at line 213 of file qgsprojectproperty.h.

§ clear()

virtual void QgsPropertyKey::clear ( )
inlinevirtual

reset the QgsProperty key to prestine state

Definition at line 282 of file qgsprojectproperty.h.

§ clearKeys()

virtual void QgsPropertyKey::clearKeys ( )
inlinevirtual

delete any sub-nodes

Definition at line 289 of file qgsprojectproperty.h.

§ count()

int QgsPropertyKey::count ( ) const
inline

how many elements are contained within this one?

Definition at line 258 of file qgsprojectproperty.h.

§ dump()

void QgsPropertyKey::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 QgsProperty.

Definition at line 294 of file qgsprojectproperty.cpp.

§ entryList()

void QgsPropertyKey::entryList ( QStringList &  entries) const

return keys that do not contain other keys

Return keys that do not contain other keys.

Definition at line 429 of file qgsprojectproperty.cpp.

§ find()

QgsProperty* QgsPropertyKey::find ( QString &  propertyName)
inline

Definition at line 295 of file qgsprojectproperty.h.

§ isEmpty()

bool QgsPropertyKey::isEmpty ( ) const
inline

Does this property not have any subkeys or values?

Definition at line 261 of file qgsprojectproperty.h.

§ isKey()

virtual bool QgsPropertyKey::isKey ( ) const
inlineoverridevirtual

Returns true if is a QgsPropertyKey.

Implements QgsProperty.

Definition at line 264 of file qgsprojectproperty.h.

§ isLeaf()

bool QgsPropertyKey::isLeaf ( ) const
overridevirtual

Returns true if a leaf node A leaf node is a key node that has either no value or a single value.

A non-leaf node would be a key node with key sub-nodes.

Implements QgsProperty.

Definition at line 460 of file qgsprojectproperty.cpp.

§ isValue()

virtual bool QgsPropertyKey::isValue ( ) const
inlineoverridevirtual

Returns true if is a QgsPropertyValue.

Implements QgsProperty.

Definition at line 267 of file qgsprojectproperty.h.

§ name()

QString QgsPropertyKey::name ( ) const
inline

The name of the property is used as identifier.

Definition at line 196 of file qgsprojectproperty.h.

§ readXml()

bool QgsPropertyKey::readXml ( QDomNode &  keyNode)
overridevirtual

restores property hierarchy to given Dom node

Used for restoring properties from project file

Implements QgsProperty.

Definition at line 353 of file qgsprojectproperty.cpp.

§ removeKey()

void QgsPropertyKey::removeKey ( const QString &  keyName)
inline

remove the given key

Definition at line 223 of file qgsprojectproperty.h.

§ setName()

void QgsPropertyKey::setName ( const QString &  name)

The name of the property is used as identifier.

Note
Added in QGIS 3.0

Definition at line 479 of file qgsprojectproperty.cpp.

§ setValue() [1/2]

QgsPropertyValue* QgsPropertyKey::setValue ( const QString &  name,
const QVariant &  value 
)
inline

Set the value associated with this key.

Parameters
nameis the key name
valueis the value to set
Returns
pointer to property value

Definition at line 233 of file qgsprojectproperty.h.

§ setValue() [2/2]

QgsPropertyValue* QgsPropertyKey::setValue ( const QVariant &  value)
inline

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

Definition at line 246 of file qgsprojectproperty.h.

§ subkeyList()

void QgsPropertyKey::subkeyList ( QStringList &  entries) const

return keys that contain other keys

Definition at line 445 of file qgsprojectproperty.cpp.

§ value()

QVariant QgsPropertyKey::value ( ) const
overridevirtual

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

Implements QgsProperty.

Definition at line 280 of file qgsprojectproperty.cpp.

§ writeXml()

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

Property keys will always create a Dom element for itself and then recursively call writeXml for any constituent properties.

Implements QgsProperty.

Definition at line 400 of file qgsprojectproperty.cpp.


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