QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
The QgsLayerTreeMapCanvasBridge class takes care of updates of layer set for QgsMapCanvas from a layer tree. More...
#include <qgslayertreemapcanvasbridge.h>
Signals | |
void | canvasLayersChanged (const QList< QgsMapLayer * > &layers) |
Emitted when the set of layers (or order of layers) visible in the canvas changes. | |
Public Member Functions | |
QgsLayerTreeMapCanvasBridge (QgsLayerTree *root, QgsMapCanvas *canvas, QObject *parent SIP_TRANSFERTHIS=nullptr) | |
Constructor: does not take ownership of the layer tree nor canvas. | |
bool | autoSetupOnFirstLayer () const |
QgsMapCanvas * | mapCanvas () const |
QgsMapOverviewCanvas * | overviewCanvas () const |
Returns associated overview canvas (may be nullptr ) | |
QgsLayerTree * | rootGroup () const |
void | setAutoSetupOnFirstLayer (bool enabled) |
if enabled, will automatically set full canvas extent and destination CRS + map units when first layer(s) are added | |
Q_INVOKABLE void | setCanvasLayers () |
force update of canvas layers from the layer tree. Normally this should not be needed to be called. | |
void | setOverviewCanvas (QgsMapOverviewCanvas *overviewCanvas) |
Associates overview canvas with the bridge, so the overview will be updated whenever main canvas is updated. | |
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.
Definition at line 47 of file qgslayertreemapcanvasbridge.h.
QgsLayerTreeMapCanvasBridge::QgsLayerTreeMapCanvasBridge | ( | QgsLayerTree * | root, |
QgsMapCanvas * | canvas, | ||
QObject *parent | SIP_TRANSFERTHIS = nullptr |
||
) |
Constructor: does not take ownership of the layer tree nor canvas.
Definition at line 29 of file qgslayertreemapcanvasbridge.cpp.
|
inline |
Definition at line 85 of file qgslayertreemapcanvasbridge.h.
|
signal |
Emitted when the set of layers (or order of layers) visible in the canvas changes.
|
inline |
Definition at line 55 of file qgslayertreemapcanvasbridge.h.
|
inline |
Returns associated overview canvas (may be nullptr
)
Definition at line 78 of file qgslayertreemapcanvasbridge.h.
|
inline |
Definition at line 54 of file qgslayertreemapcanvasbridge.h.
|
inline |
if enabled, will automatically set full canvas extent and destination CRS + map units when first layer(s) are added
Definition at line 84 of file qgslayertreemapcanvasbridge.h.
void QgsLayerTreeMapCanvasBridge::setCanvasLayers | ( | ) |
force update of canvas layers from the layer tree. Normally this should not be needed to be called.
Definition at line 46 of file qgslayertreemapcanvasbridge.cpp.
|
inline |
Associates overview canvas with the bridge, so the overview will be updated whenever main canvas is updated.
Definition at line 61 of file qgslayertreemapcanvasbridge.h.