QGIS API Documentation  2.15.0-Master (1f0fce7)
Static Public Member Functions | List of all members
QgsLayerTreeUtils Class Reference

Assorted functions for dealing with layer trees. More...

#include <qgslayertreeutils.h>

Static Public Member Functions

static Qt::CheckState checkStateFromXml (const QString &txt)
 Convert QString to Qt::CheckState. More...
 
static QString checkStateToXml (Qt::CheckState state)
 Convert Qt::CheckState to QString. More...
 
static bool hasLegendFilterExpression (const QgsLayerTreeGroup &group)
 Test if one of the layers in a group has an expression filter. More...
 
static QgsLayerTreeLayerinsertLayerBelow (QgsLayerTreeGroup *group, const QgsMapLayer *refLayer, QgsMapLayer *layerToInsert)
 Insert a QgsMapLayer just below another one. More...
 
static QStringList invisibleLayerList (QgsLayerTreeNode *node)
 get invisible layers More...
 
static bool layersEditable (const QList< QgsLayerTreeLayer * > &layerNodes)
 Return true if any of the layers is editable. More...
 
static bool layersModified (const QList< QgsLayerTreeLayer * > &layerNodes)
 Return true if any of the layers is modified. More...
 
static QString legendFilterByExpression (const QgsLayerTreeLayer &layer, bool *enabled=nullptr)
 Return the expression filter of a legend layer. More...
 
static bool readOldLegend (QgsLayerTreeGroup *root, const QDomElement &legendElem)
 Try to load layer tree from. More...
 
static bool readOldLegendLayerOrder (const QDomElement &legendElem, bool &hasCustomOrder, QStringList &order)
 Try to load custom layer order from. More...
 
static void removeInvalidLayers (QgsLayerTreeGroup *group)
 Remove layer nodes that refer to invalid layers. More...
 
static void replaceChildrenOfEmbeddedGroups (QgsLayerTreeGroup *group)
 Remove subtree of embedded groups and replaces it with a custom property embedded-visible-layers. More...
 
static void setLegendFilterByExpression (QgsLayerTreeLayer &layer, const QString &expr, bool enabled=true)
 Set the expression filter of a legend layer. More...
 
static void updateEmbeddedGroupsProjectPath (QgsLayerTreeGroup *group)
 
static QDomElement writeOldLegend (QDomDocument &doc, QgsLayerTreeGroup *root, bool hasCustomOrder, const QStringList &order)
 Return. More...
 

Detailed Description

Assorted functions for dealing with layer trees.

Note
added in 2.4

Definition at line 37 of file qgslayertreeutils.h.

Member Function Documentation

Qt::CheckState QgsLayerTreeUtils::checkStateFromXml ( const QString txt)
static

Convert QString to Qt::CheckState.

Definition at line 197 of file qgslayertreeutils.cpp.

QString QgsLayerTreeUtils::checkStateToXml ( Qt::CheckState  state)
static

Convert Qt::CheckState to QString.

Definition at line 183 of file qgslayertreeutils.cpp.

bool QgsLayerTreeUtils::hasLegendFilterExpression ( const QgsLayerTreeGroup group)
static

Test if one of the layers in a group has an expression filter.

Definition at line 384 of file qgslayertreeutils.cpp.

QgsLayerTreeLayer * QgsLayerTreeUtils::insertLayerBelow ( QgsLayerTreeGroup group,
const QgsMapLayer refLayer,
QgsMapLayer layerToInsert 
)
static

Insert a QgsMapLayer just below another one.

Parameters
groupthe tree group where layers are (can be the root group)
refLayerthe reference layer
layerToInsertthe new layer to insert just below the reference layer
Returns
the new tree layer

Definition at line 398 of file qgslayertreeutils.cpp.

QStringList QgsLayerTreeUtils::invisibleLayerList ( QgsLayerTreeNode node)
static

get invisible layers

Definition at line 311 of file qgslayertreeutils.cpp.

bool QgsLayerTreeUtils::layersEditable ( const QList< QgsLayerTreeLayer * > &  layerNodes)
static

Return true if any of the layers is editable.

Definition at line 265 of file qgslayertreeutils.cpp.

bool QgsLayerTreeUtils::layersModified ( const QList< QgsLayerTreeLayer * > &  layerNodes)
static

Return true if any of the layers is modified.

Definition at line 279 of file qgslayertreeutils.cpp.

QString QgsLayerTreeUtils::legendFilterByExpression ( const QgsLayerTreeLayer layer,
bool *  enabled = nullptr 
)
static

Return the expression filter of a legend layer.

Definition at line 377 of file qgslayertreeutils.cpp.

bool QgsLayerTreeUtils::readOldLegend ( QgsLayerTreeGroup root,
const QDomElement legendElem 
)
static

Try to load layer tree from.

<legend> 

tag from project files from QGIS 2.2 and below

Definition at line 30 of file qgslayertreeutils.cpp.

bool QgsLayerTreeUtils::readOldLegendLayerOrder ( const QDomElement legendElem,
bool &  hasCustomOrder,
QStringList order 
)
static

Try to load custom layer order from.

<legend> 

tag from project files from QGIS 2.2 and below

Definition at line 82 of file qgslayertreeutils.cpp.

void QgsLayerTreeUtils::removeInvalidLayers ( QgsLayerTreeGroup group)
static

Remove layer nodes that refer to invalid layers.

Definition at line 293 of file qgslayertreeutils.cpp.

void QgsLayerTreeUtils::replaceChildrenOfEmbeddedGroups ( QgsLayerTreeGroup group)
static

Remove subtree of embedded groups and replaces it with a custom property embedded-visible-layers.

Definition at line 333 of file qgslayertreeutils.cpp.

void QgsLayerTreeUtils::setLegendFilterByExpression ( QgsLayerTreeLayer layer,
const QString expr,
bool  enabled = true 
)
static

Set the expression filter of a legend layer.

Definition at line 371 of file qgslayertreeutils.cpp.

void QgsLayerTreeUtils::updateEmbeddedGroupsProjectPath ( QgsLayerTreeGroup group)
static
Note
not available in python bindings

Definition at line 353 of file qgslayertreeutils.cpp.

QDomElement QgsLayerTreeUtils::writeOldLegend ( QDomDocument doc,
QgsLayerTreeGroup root,
bool  hasCustomOrder,
const QStringList order 
)
static

Return.

<legend> 

tag used in QGIS 2.2 and below

Definition at line 172 of file qgslayertreeutils.cpp.


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