QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
|
Project property key node. More...
#include <qgsprojectproperty.h>
Public Member Functions | |
QgsProjectPropertyKey (const QString &name=QString()) | |
Create a new QgsProjectPropertyKey with the specified identifier. | |
~QgsProjectPropertyKey () override | |
QgsProjectPropertyKey * | addKey (const QString &keyName) |
Adds the specified property key as a sub-key. | |
virtual void | clear () |
Resets the property to a default, empty state. | |
virtual void | clearKeys () |
Deletes any sub-nodes from the property. | |
int | count () const |
Returns the number of sub-keys contained by this property. | |
void | dump (int tabs=0) const override |
Dumps out the keys and values. | |
void | entryList (QStringList &entries) const |
Returns any sub-keys contained by this property that do not contain other keys. | |
QgsProjectProperty * | find (const QString &propertyName) const |
Attempts to find a property with a matching sub-key name. | |
bool | isEmpty () const |
Returns true if this property contains no sub-keys. | |
bool | isKey () const override |
Returns true if the property is a QgsProjectPropertyKey. | |
bool | isLeaf () const override |
Returns true if property is a leaf node. | |
bool | isValue () const override |
Returns true if the property is a QgsProjectPropertyValue. | |
QString | name () const |
The name of the property is used as identifier. | |
bool | readXml (const QDomNode &keyNode) override |
Restores the property hierarchy from a specified DOM node. | |
void | removeKey (const QString &keyName) |
Removes the specified key. | |
void | setName (const QString &name) |
The name of the property is used as identifier. | |
QgsProjectPropertyValue * | setValue (const QString &name, const QVariant &value) |
Sets the value associated with this key. | |
QgsProjectPropertyValue * | setValue (const QVariant &value) |
Set the value associated with this key. | |
void | subkeyList (QStringList &entries) const |
Returns any sub-keys contained by this property which themselves contain other keys. | |
QVariant | value () const override |
If this key has a value, it will be stored by its name in its properties. | |
bool | writeXml (const QString &nodeName, QDomElement &element, QDomDocument &document) override |
Writes the property hierarchy to a specified DOM element. | |
![]() | |
QgsProjectProperty () | |
virtual | ~QgsProjectProperty ()=default |
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.
Definition at line 180 of file qgsprojectproperty.h.
QgsProjectPropertyKey::QgsProjectPropertyKey | ( | const QString & | name = QString() | ) |
Create a new QgsProjectPropertyKey with the specified identifier.
Definition at line 272 of file qgsprojectproperty.cpp.
|
override |
Definition at line 276 of file qgsprojectproperty.cpp.
|
inline |
Adds the specified property key as a sub-key.
Definition at line 214 of file qgsprojectproperty.h.
|
inlinevirtual |
Resets the property to a default, empty state.
Definition at line 294 of file qgsprojectproperty.h.
|
inlinevirtual |
Deletes any sub-nodes from the property.
Definition at line 303 of file qgsprojectproperty.h.
|
inline |
Returns the number of sub-keys contained by this property.
Definition at line 268 of file qgsprojectproperty.h.
|
overridevirtual |
Dumps out the keys and values.
tabs | is number of tabs to print; used for pretty-printing hierarchy |
Implements QgsProjectProperty.
Definition at line 295 of file qgsprojectproperty.cpp.
void QgsProjectPropertyKey::entryList | ( | QStringList & | entries | ) | const |
Returns any sub-keys contained by this property that do not contain other keys.
Definition at line 426 of file qgsprojectproperty.cpp.
|
inline |
Attempts to find a property with a matching sub-key name.
Definition at line 312 of file qgsprojectproperty.h.
|
inline |
Returns true
if this property contains no sub-keys.
Definition at line 273 of file qgsprojectproperty.h.
|
inlineoverridevirtual |
Returns true
if the property is a QgsProjectPropertyKey.
Implements QgsProjectProperty.
Definition at line 275 of file qgsprojectproperty.h.
|
overridevirtual |
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 455 of file qgsprojectproperty.cpp.
|
inlineoverridevirtual |
Returns true
if the property is a QgsProjectPropertyValue.
Implements QgsProjectProperty.
Definition at line 276 of file qgsprojectproperty.h.
|
inline |
The name of the property is used as identifier.
Definition at line 196 of file qgsprojectproperty.h.
|
overridevirtual |
Restores the property hierarchy from a specified DOM node.
Used for restoring properties from project file
Implements QgsProjectProperty.
Definition at line 354 of file qgsprojectproperty.cpp.
|
inline |
Removes the specified key.
Definition at line 228 of file qgsprojectproperty.h.
void QgsProjectPropertyKey::setName | ( | const QString & | name | ) |
The name of the property is used as identifier.
Definition at line 474 of file qgsprojectproperty.cpp.
|
inline |
Sets the value associated with this key.
name | is the key name |
value | is the value to set |
Definition at line 239 of file qgsprojectproperty.h.
|
inline |
Set the value associated with this key.
Definition at line 256 of file qgsprojectproperty.h.
void QgsProjectPropertyKey::subkeyList | ( | QStringList & | entries | ) | const |
Returns any sub-keys contained by this property which themselves contain other keys.
Definition at line 440 of file qgsprojectproperty.cpp.
|
overridevirtual |
If this key has a value, it will be stored by its name in its properties.
Implements QgsProjectProperty.
Definition at line 281 of file qgsprojectproperty.cpp.
|
overridevirtual |
Writes the property hierarchy to a specified DOM element.
Used for saving properties to project file.
nodeName | the tag name associated with this element |
element | the parent (or encompassing) property element |
document | the overall project file Dom document |
Implements QgsProjectProperty.
Definition at line 402 of file qgsprojectproperty.cpp.