QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
Signals | Public Member Functions | List of all members
QgsLayerTreeMapCanvasBridge Class Reference

The QgsLayerTreeMapCanvasBridge class takes care of updates of layer set for QgsMapCanvas from a layer tree. More...

#include <qgslayertreemapcanvasbridge.h>

Inheritance diagram for QgsLayerTreeMapCanvasBridge:
Inheritance graph
[legend]

Signals

void canvasLayersChanged (const QList< QgsMapLayer * > &layers)
 Emitted when the set of layers (or order of layers) visible in the canvas changes. More...
 

Public Member Functions

 QgsLayerTreeMapCanvasBridge (QgsLayerTree *root, QgsMapCanvas *canvas, QObject *parent=nullptr)
 Constructor: does not take ownership of the layer tree nor canvas. More...
 
bool autoSetupOnFirstLayer () const
 
QgsMapCanvasmapCanvas () const
 
QgsMapOverviewCanvasoverviewCanvas () const
 Returns associated overview canvas (may be nullptr) More...
 
QgsLayerTreerootGroup () const
 
void setAutoSetupOnFirstLayer (bool enabled)
 if enabled, will automatically set full canvas extent and destination CRS + map units when first layer(s) are added More...
 
Q_INVOKABLE void setCanvasLayers ()
 force update of canvas layers from the layer tree. Normally this should not be needed to be called. More...
 
void setOverviewCanvas (QgsMapOverviewCanvas *overviewCanvas)
 Associates overview canvas with the bridge, so the overview will be updated whenever main canvas is updated. More...
 

Detailed Description

The QgsLayerTreeMapCanvasBridge class takes care of updates of layer set for QgsMapCanvas from a layer tree.

The class listens to the updates in the layer tree and updates the list of layers for rendering whenever some layers are added, removed, or their visibility changes.

The update of layers is not done immediately - it is postponed, so a series of updates to the layer tree will trigger just one update of canvas layers.

Also allows the client to override the default order of layers. This is useful in advanced cases where the grouping in layer tree should be independent from the actual order in the canvas.

Since
QGIS 2.4

Definition at line 48 of file qgslayertreemapcanvasbridge.h.

Constructor & Destructor Documentation

◆ QgsLayerTreeMapCanvasBridge()

QgsLayerTreeMapCanvasBridge::QgsLayerTreeMapCanvasBridge ( QgsLayerTree root,
QgsMapCanvas canvas,
QObject *  parent = nullptr 
)

Constructor: does not take ownership of the layer tree nor canvas.

Definition at line 28 of file qgslayertreemapcanvasbridge.cpp.

Member Function Documentation

◆ autoSetupOnFirstLayer()

bool QgsLayerTreeMapCanvasBridge::autoSetupOnFirstLayer ( ) const
inline

Definition at line 88 of file qgslayertreemapcanvasbridge.h.

◆ canvasLayersChanged

void QgsLayerTreeMapCanvasBridge::canvasLayersChanged ( const QList< QgsMapLayer * > &  layers)
signal

Emitted when the set of layers (or order of layers) visible in the canvas changes.

Since
QGIS 3.0

◆ mapCanvas()

QgsMapCanvas* QgsLayerTreeMapCanvasBridge::mapCanvas ( ) const
inline

Definition at line 56 of file qgslayertreemapcanvasbridge.h.

◆ overviewCanvas()

QgsMapOverviewCanvas* QgsLayerTreeMapCanvasBridge::overviewCanvas ( ) const
inline

Returns associated overview canvas (may be nullptr)

Since
QGIS 3.0

Definition at line 81 of file qgslayertreemapcanvasbridge.h.

◆ rootGroup()

QgsLayerTree* QgsLayerTreeMapCanvasBridge::rootGroup ( ) const
inline

Definition at line 55 of file qgslayertreemapcanvasbridge.h.

◆ setAutoSetupOnFirstLayer()

void QgsLayerTreeMapCanvasBridge::setAutoSetupOnFirstLayer ( bool  enabled)
inline

if enabled, will automatically set full canvas extent and destination CRS + map units when first layer(s) are added

Definition at line 87 of file qgslayertreemapcanvasbridge.h.

◆ setCanvasLayers()

void QgsLayerTreeMapCanvasBridge::setCanvasLayers ( )

force update of canvas layers from the layer tree. Normally this should not be needed to be called.

Definition at line 45 of file qgslayertreemapcanvasbridge.cpp.

◆ setOverviewCanvas()

void QgsLayerTreeMapCanvasBridge::setOverviewCanvas ( QgsMapOverviewCanvas overviewCanvas)
inline

Associates overview canvas with the bridge, so the overview will be updated whenever main canvas is updated.

Since
QGIS 3.6

Definition at line 62 of file qgslayertreemapcanvasbridge.h.


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