31 QgsLayerSettings settings;
32 settings.name = layer->name();
34 settings.mNamedStyle = layer->styleManager()->currentStyle();
36 switch ( layer->type() )
44 settings.mOpacity = vLayer->
opacity();
69 mLayerSettings[layer] = settings;
78 const QString sldStyleName { layer->customProperty(
"sldStyleName",
"" ).toString() };
79 if ( !sldStyleName.isEmpty() )
81 layer->styleManager()->removeStyle( sldStyleName );
82 layer->removeCustomProperty(
"sldStyleName" );
86 const QgsLayerSettings settings = mLayerSettings[layer];
87 layer->styleManager()->setCurrentStyle( settings.mNamedStyle );
88 layer->setName( mLayerSettings[layer].name );
90 switch ( layer->type() )
99 vLayer->
selectByIds( settings.mSelectedFeatureIds );
128 : mLayerRestorer( context.layers() )
~QgsLayerRestorer()
Destructor.
QgsLayerRestorer(const QList< QgsMapLayer * > &layers)
Constructor for QgsLayerRestorer.
Base class for all map layer types.
virtual void setOpacity(double opacity)
Sets the opacity for the layer, where opacity is a value between 0 (totally transparent) and 1....
Represents a raster layer.
QgsRasterRenderer * renderer() const
Returns the raster's renderer.
double opacity() const
Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1....
void setOpacity(double opacity)
Sets the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1....
Represents a vector layer which manages a vector based data sets.
Q_INVOKABLE const QgsFeatureIds & selectedFeatureIds() const
Returns a list of the selected features IDs in this layer.
Q_INVOKABLE void selectByIds(const QgsFeatureIds &ids, Qgis::SelectBehavior behavior=Qgis::SelectBehavior::SetSelection)
Selects matching features using a list of feature IDs.
virtual bool setSubsetString(const QString &subset)
Sets the string (typically sql) used to define a subset of the layer.
Rendering context for the WMS renderer.
QgsWmsRestorer(const QgsWmsRenderContext &context)
Constructor for QgsWmsRestorer.
@ PointCloudLayer
Added in 3.18.
@ VectorTileLayer
Added in 3.14.
@ AnnotationLayer
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
Median cut implementation.