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;
77 QgsLayerSettings settings = mLayerSettings[layer];
78 layer->styleManager()->setCurrentStyle( settings.mNamedStyle );
79 layer->setName( mLayerSettings[layer].name );
82 const QString sldStyleName { layer->customProperty(
"sldStyleName",
"" ).toString() };
83 if ( !sldStyleName.isEmpty() )
85 layer->styleManager()->removeStyle( sldStyleName );
86 layer->removeCustomProperty(
"sldStyleName" );
89 switch ( layer->type() )
98 vLayer->
selectByIds( settings.mSelectedFeatureIds );
127 : 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.
virtual bool setSubsetString(const QString &subset)
Sets the string (typically sql) used to define a subset of the layer.
Q_INVOKABLE void selectByIds(const QgsFeatureIds &ids, QgsVectorLayer::SelectBehavior behavior=QgsVectorLayer::SetSelection)
Selects matching features using a list of feature IDs.
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.