QGIS API Documentation  3.8.0-Zanzibar (11aff65)
Signals | Public Member Functions | Protected Slots | Protected Attributes | List of all members
QgsLayerTreeRegistryBridge Class Reference

Listens to the updates in map layer registry and does changes in layer tree. More...

#include <qgslayertreeregistrybridge.h>

Inheritance diagram for QgsLayerTreeRegistryBridge:
Inheritance graph
[legend]

Signals

void addedLayersToLayerTree (const QList< QgsMapLayer *> &layers)
 Tell others we have just added layers to the tree (used in QGIS to auto-select first newly added layer) More...
 

Public Member Functions

 QgsLayerTreeRegistryBridge (QgsLayerTreeGroup *root, QgsProject *project, QObject *parent=nullptr)
 Create the instance that synchronizes given project with a layer tree root. More...
 
bool isEnabled () const
 
bool newLayersVisible () const
 
void setEnabled (bool enabled)
 
void setLayerInsertionPoint (QgsLayerTreeGroup *parentGroup, int index)
 Set where the new layers should be inserted - can be used to follow current selection. More...
 
void setNewLayersVisible (bool enabled)
 

Protected Slots

void groupRemovedChildren ()
 
void groupWillRemoveChildren (QgsLayerTreeNode *node, int indexFrom, int indexTo)
 
void layersAdded (const QList< QgsMapLayer *> &layers)
 
void layersWillBeRemoved (const QStringList &layerIds)
 
void removeLayersFromRegistry (const QStringList &layerIds)
 

Protected Attributes

bool mEnabled
 
QgsLayerTreeGroupmInsertionPointGroup = nullptr
 
int mInsertionPointIndex
 
QStringList mLayerIdsForRemoval
 
bool mNewLayersVisible
 
QgsProjectmProject = nullptr
 
bool mRegistryRemovingLayers
 
QgsLayerTreeGroupmRoot = nullptr
 

Detailed Description

Listens to the updates in map layer registry and does changes in layer tree.

When connected to a layer tree, any layers added to the map layer registry will be also added to the layer tree. Similarly, map layers that are removed from registry will be removed from the layer tree.

If a layer is completely removed from the layer tree, it will be also removed from the map layer registry.

Since
QGIS 2.4

Definition at line 44 of file qgslayertreeregistrybridge.h.

Constructor & Destructor Documentation

◆ QgsLayerTreeRegistryBridge()

QgsLayerTreeRegistryBridge::QgsLayerTreeRegistryBridge ( QgsLayerTreeGroup root,
QgsProject project,
QObject *  parent = nullptr 
)
explicit

Create the instance that synchronizes given project with a layer tree root.

Definition at line 23 of file qgslayertreeregistrybridge.cpp.

Member Function Documentation

◆ addedLayersToLayerTree

void QgsLayerTreeRegistryBridge::addedLayersToLayerTree ( const QList< QgsMapLayer *> &  layers)
signal

Tell others we have just added layers to the tree (used in QGIS to auto-select first newly added layer)

Since
QGIS 2.6

◆ groupRemovedChildren

void QgsLayerTreeRegistryBridge::groupRemovedChildren ( )
protectedslot

Definition at line 128 of file qgslayertreeregistrybridge.cpp.

◆ groupWillRemoveChildren

void QgsLayerTreeRegistryBridge::groupWillRemoveChildren ( QgsLayerTreeNode node,
int  indexFrom,
int  indexTo 
)
protectedslot

Definition at line 115 of file qgslayertreeregistrybridge.cpp.

◆ isEnabled()

bool QgsLayerTreeRegistryBridge::isEnabled ( ) const
inline

Definition at line 52 of file qgslayertreeregistrybridge.h.

◆ layersAdded

void QgsLayerTreeRegistryBridge::layersAdded ( const QList< QgsMapLayer *> &  layers)
protectedslot

Definition at line 46 of file qgslayertreeregistrybridge.cpp.

◆ layersWillBeRemoved

void QgsLayerTreeRegistryBridge::layersWillBeRemoved ( const QStringList &  layerIds)
protectedslot

Definition at line 76 of file qgslayertreeregistrybridge.cpp.

◆ newLayersVisible()

bool QgsLayerTreeRegistryBridge::newLayersVisible ( ) const
inline

Definition at line 55 of file qgslayertreeregistrybridge.h.

◆ removeLayersFromRegistry

void QgsLayerTreeRegistryBridge::removeLayersFromRegistry ( const QStringList &  layerIds)
protectedslot

Definition at line 150 of file qgslayertreeregistrybridge.cpp.

◆ setEnabled()

void QgsLayerTreeRegistryBridge::setEnabled ( bool  enabled)
inline

Definition at line 51 of file qgslayertreeregistrybridge.h.

◆ setLayerInsertionPoint()

void QgsLayerTreeRegistryBridge::setLayerInsertionPoint ( QgsLayerTreeGroup parentGroup,
int  index 
)

Set where the new layers should be inserted - can be used to follow current selection.

By default it is root group with zero index.

Definition at line 40 of file qgslayertreeregistrybridge.cpp.

◆ setNewLayersVisible()

void QgsLayerTreeRegistryBridge::setNewLayersVisible ( bool  enabled)
inline

Definition at line 54 of file qgslayertreeregistrybridge.h.

Member Data Documentation

◆ mEnabled

bool QgsLayerTreeRegistryBridge::mEnabled
protected

Definition at line 85 of file qgslayertreeregistrybridge.h.

◆ mInsertionPointGroup

QgsLayerTreeGroup* QgsLayerTreeRegistryBridge::mInsertionPointGroup = nullptr
protected

Definition at line 88 of file qgslayertreeregistrybridge.h.

◆ mInsertionPointIndex

int QgsLayerTreeRegistryBridge::mInsertionPointIndex
protected

Definition at line 89 of file qgslayertreeregistrybridge.h.

◆ mLayerIdsForRemoval

QStringList QgsLayerTreeRegistryBridge::mLayerIdsForRemoval
protected

Definition at line 83 of file qgslayertreeregistrybridge.h.

◆ mNewLayersVisible

bool QgsLayerTreeRegistryBridge::mNewLayersVisible
protected

Definition at line 86 of file qgslayertreeregistrybridge.h.

◆ mProject

QgsProject* QgsLayerTreeRegistryBridge::mProject = nullptr
protected

Definition at line 82 of file qgslayertreeregistrybridge.h.

◆ mRegistryRemovingLayers

bool QgsLayerTreeRegistryBridge::mRegistryRemovingLayers
protected

Definition at line 84 of file qgslayertreeregistrybridge.h.

◆ mRoot

QgsLayerTreeGroup* QgsLayerTreeRegistryBridge::mRoot = nullptr
protected

Definition at line 81 of file qgslayertreeregistrybridge.h.


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