|
QGIS API Documentation
2.6.0-Brighton
|
Layer tree group node serves as a container for layers and further groups. More...
#include <qgslayertreegroup.h>

Public Member Functions | |
| QgsLayerTreeGroup (const QString &name=QString(), Qt::CheckState checked=Qt::Checked) | |
| QgsLayerTreeGroup (const QgsLayerTreeGroup &other) | |
| QString | name () const |
| Get group's name. | |
| void | setName (const QString &n) |
| Set group's name. | |
| QgsLayerTreeGroup * | insertGroup (int index, const QString &name) |
| Insert a new group node with given name at specified position. Newly created node is owned by this group. | |
| QgsLayerTreeGroup * | addGroup (const QString &name) |
| Append a new group node with given name. Newly created node is owned by this group. | |
| QgsLayerTreeLayer * | insertLayer (int index, QgsMapLayer *layer) |
| Insert a new layer node for given map layer at specified position. Newly created node is owned by this group. | |
| QgsLayerTreeLayer * | addLayer (QgsMapLayer *layer) |
| Append a new layer node for given map layer. Newly created node is owned by this group. | |
| void | insertChildNodes (int index, QList< QgsLayerTreeNode * > nodes) |
| Insert existing nodes at specified position. The nodes must not have a parent yet. The nodes will be owned by this group. | |
| void | insertChildNode (int index, QgsLayerTreeNode *node) |
| Insert existing node at specified position. The node must not have a parent yet. The node will be owned by this group. | |
| void | addChildNode (QgsLayerTreeNode *node) |
| Append an existing node. The node must not have a parent yet. The node will be owned by this group. | |
| void | removeChildNode (QgsLayerTreeNode *node) |
| Remove a child node from this group. The node will be deleted. | |
| void | removeLayer (QgsMapLayer *layer) |
| Remove map layer's node from this group. The node will be deleted. | |
| void | removeChildren (int from, int count) |
| Remove child nodes from index "from". The nodes will be deleted. | |
| void | removeChildrenGroupWithoutLayers () |
| Remove all child group nodes without layers. The groupnodes will be deleted. | |
| void | removeAllChildren () |
| Remove all child nodes. The nodes will be deleted. | |
| QgsLayerTreeLayer * | findLayer (const QString &layerId) const |
| Find layer node representing the map layer specified by its ID. Searches recursively the whole sub-tree. | |
| QList< QgsLayerTreeLayer * > | findLayers () const |
| Find all layer nodes. Searches recursively the whole sub-tree. | |
| QStringList | findLayerIds () const |
| Find layer IDs used in all layer nodes. Searches recursively the whole sub-tree. | |
| QgsLayerTreeGroup * | findGroup (const QString &name) |
| Find group node with specified name. Searches recursively the whole sub-tree. | |
| virtual void | writeXML (QDomElement &parentElement) |
| Write group (tree) as XML element <layer-tree-group> and add it to the given parent element. | |
| void | readChildrenFromXML (QDomElement &element) |
| Read children from XML and append them to the group. | |
| virtual QString | dump () const |
| Return text representation of the tree. For debugging purposes only. | |
| virtual QgsLayerTreeNode * | clone () const |
| Return a clone of the group. The children are cloned too. | |
| Qt::CheckState | isVisible () const |
| Return the check state of the group node. | |
| void | setVisible (Qt::CheckState state) |
| Set check state of the group node - will also update children. | |
Public Member Functions inherited from QgsLayerTreeNode | |
| ~QgsLayerTreeNode () | |
| NodeType | nodeType () |
| Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree namespace for that. | |
| QgsLayerTreeNode * | parent () |
| Get pointer to the parent. If parent is a null pointer, the node is a root node. | |
| QList< QgsLayerTreeNode * > | children () |
| Get list of children of the node. Children are owned by the parent. | |
| bool | isExpanded () const |
| Return whether the node should be shown as expanded or collapsed in GUI. | |
| void | setExpanded (bool expanded) |
| Set whether the node should be shown as expanded or collapsed in GUI. | |
| void | setCustomProperty (const QString &key, const QVariant &value) |
| Set a custom property for the node. | |
| QVariant | customProperty (const QString &key, const QVariant &defaultValue=QVariant()) const |
| Read a custom property from layer. | |
| void | removeCustomProperty (const QString &key) |
| Remove a custom property from layer. | |
| QStringList | customProperties () const |
| Return list of keys stored in custom properties. | |
Static Public Member Functions | |
| static QgsLayerTreeGroup * | readXML (QDomElement &element) |
| Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error) | |
Protected Slots | |
| void | layerDestroyed () |
| void | nodeVisibilityChanged (QgsLayerTreeNode *node) |
Protected Member Functions | |
| void | updateVisibilityFromChildren () |
Protected Member Functions inherited from QgsLayerTreeNode | |
| QgsLayerTreeNode (NodeType t) | |
| QgsLayerTreeNode (const QgsLayerTreeNode &other) | |
| void | readCommonXML (QDomElement &element) |
| void | writeCommonXML (QDomElement &element) |
| void | insertChildrenPrivate (int index, QList< QgsLayerTreeNode * > nodes) |
| Low-level insertion of children to the node. The children must not have any parent yet! | |
| void | removeChildrenPrivate (int from, int count) |
| Low-level removal of children from the node. | |
Protected Attributes | |
| QString | mName |
| Qt::CheckState | mChecked |
| bool | mChangingChildVisibility |
Protected Attributes inherited from QgsLayerTreeNode | |
| NodeType | mNodeType |
| type of the node - determines which subclass is used | |
| QgsLayerTreeNode * | mParent |
| pointer to the parent node - null in case of root node | |
| QList< QgsLayerTreeNode * > | mChildren |
| list of children - node is responsible for their deletion | |
| bool | mExpanded |
| whether the node should be shown in GUI as expanded | |
| QgsObjectCustomProperties | mProperties |
| custom properties attached to the node | |
Additional Inherited Members | |
Public Types inherited from QgsLayerTreeNode | |
| enum | NodeType { NodeGroup, NodeLayer } |
| Enumeration of possible tree node types. More... | |
Signals inherited from QgsLayerTreeNode | |
| void | willAddChildren (QgsLayerTreeNode *node, int indexFrom, int indexTo) |
| Emitted when one or more nodes will be added to a node within the tree. | |
| void | addedChildren (QgsLayerTreeNode *node, int indexFrom, int indexTo) |
| Emitted when one or more nodes have been added to a node within the tree. | |
| void | willRemoveChildren (QgsLayerTreeNode *node, int indexFrom, int indexTo) |
| Emitted when one or more nodes will be removed from a node within the tree. | |
| void | removedChildren (QgsLayerTreeNode *node, int indexFrom, int indexTo) |
| Emitted when one or more nodes has been removed from a node within the tree. | |
| void | visibilityChanged (QgsLayerTreeNode *node, Qt::CheckState state) |
| Emitted when check state of a node within the tree has been changed. | |
| void | customPropertyChanged (QgsLayerTreeNode *node, QString key) |
| Emitted when a custom property of a node within the tree has been changed or removed. | |
| void | expandedChanged (QgsLayerTreeNode *node, bool expanded) |
| Emitted when the collapsed/expanded state of a node within the tree has been changed. | |
Layer tree group node serves as a container for layers and further groups.
Group names do not need to be unique within one tree nor within one parent.
| QgsLayerTreeGroup::QgsLayerTreeGroup | ( | const QString & | name = QString(), |
| Qt::CheckState | checked = Qt::Checked |
||
| ) |
| QgsLayerTreeGroup::QgsLayerTreeGroup | ( | const QgsLayerTreeGroup & | other | ) |
| void QgsLayerTreeGroup::addChildNode | ( | QgsLayerTreeNode * | node | ) |
Append an existing node. The node must not have a parent yet. The node will be owned by this group.
| QgsLayerTreeGroup * QgsLayerTreeGroup::addGroup | ( | const QString & | name | ) |
Append a new group node with given name. Newly created node is owned by this group.
| QgsLayerTreeLayer * QgsLayerTreeGroup::addLayer | ( | QgsMapLayer * | layer | ) |
Append a new layer node for given map layer. Newly created node is owned by this group.
|
virtual |
Return a clone of the group. The children are cloned too.
Implements QgsLayerTreeNode.
|
virtual |
Return text representation of the tree. For debugging purposes only.
Implements QgsLayerTreeNode.
| QgsLayerTreeGroup * QgsLayerTreeGroup::findGroup | ( | const QString & | name | ) |
Find group node with specified name. Searches recursively the whole sub-tree.
| QgsLayerTreeLayer * QgsLayerTreeGroup::findLayer | ( | const QString & | layerId | ) | const |
Find layer node representing the map layer specified by its ID. Searches recursively the whole sub-tree.
| QStringList QgsLayerTreeGroup::findLayerIds | ( | ) | const |
Find layer IDs used in all layer nodes. Searches recursively the whole sub-tree.
| QList< QgsLayerTreeLayer * > QgsLayerTreeGroup::findLayers | ( | ) | const |
Find all layer nodes. Searches recursively the whole sub-tree.
| void QgsLayerTreeGroup::insertChildNode | ( | int | index, |
| QgsLayerTreeNode * | node | ||
| ) |
Insert existing node at specified position. The node must not have a parent yet. The node will be owned by this group.
| void QgsLayerTreeGroup::insertChildNodes | ( | int | index, |
| QList< QgsLayerTreeNode * > | nodes | ||
| ) |
Insert existing nodes at specified position. The nodes must not have a parent yet. The nodes will be owned by this group.
| QgsLayerTreeGroup * QgsLayerTreeGroup::insertGroup | ( | int | index, |
| const QString & | name | ||
| ) |
Insert a new group node with given name at specified position. Newly created node is owned by this group.
| QgsLayerTreeLayer * QgsLayerTreeGroup::insertLayer | ( | int | index, |
| QgsMapLayer * | layer | ||
| ) |
Insert a new layer node for given map layer at specified position. Newly created node is owned by this group.
|
inline |
Return the check state of the group node.
|
protectedslot |
|
inline |
Get group's name.
|
protectedslot |
| void QgsLayerTreeGroup::readChildrenFromXML | ( | QDomElement & | element | ) |
Read children from XML and append them to the group.
|
static |
Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error)
Reimplemented from QgsLayerTreeNode.
| void QgsLayerTreeGroup::removeAllChildren | ( | ) |
Remove all child nodes. The nodes will be deleted.
| void QgsLayerTreeGroup::removeChildNode | ( | QgsLayerTreeNode * | node | ) |
Remove a child node from this group. The node will be deleted.
| void QgsLayerTreeGroup::removeChildren | ( | int | from, |
| int | count | ||
| ) |
Remove child nodes from index "from". The nodes will be deleted.
| void QgsLayerTreeGroup::removeChildrenGroupWithoutLayers | ( | ) |
Remove all child group nodes without layers. The groupnodes will be deleted.
| void QgsLayerTreeGroup::removeLayer | ( | QgsMapLayer * | layer | ) |
Remove map layer's node from this group. The node will be deleted.
|
inline |
Set group's name.
| void QgsLayerTreeGroup::setVisible | ( | Qt::CheckState | state | ) |
Set check state of the group node - will also update children.
|
protected |
|
virtual |
Write group (tree) as XML element <layer-tree-group> and add it to the given parent element.
Implements QgsLayerTreeNode.
|
protected |
|
protected |
|
protected |
1.8.1.2