File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -7691,6 +7691,24 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *>& lyrList )
7691
7691
{
7692
7692
dupVLayer->setProviderEncoding ( vlayer->dataProvider ()->encoding () );
7693
7693
}
7694
+
7695
+ // add variables defined in layer properties
7696
+ QStringList variableNames = vlayer->customProperty ( " variableNames" ).toStringList ();
7697
+ QStringList variableValues = vlayer->customProperty ( " variableValues" ).toStringList ();
7698
+
7699
+ int varIndex = 0 ;
7700
+ Q_FOREACH ( const QString& variableName, variableNames )
7701
+ {
7702
+ if ( varIndex >= variableValues.length () )
7703
+ {
7704
+ break ;
7705
+ }
7706
+
7707
+ QVariant varValue = variableValues.at ( varIndex );
7708
+ varIndex++;
7709
+ QgsExpressionContextUtils::setLayerVariable ( dupVLayer, variableName, varValue );
7710
+ }
7711
+
7694
7712
dupLayer = dupVLayer;
7695
7713
}
7696
7714
}
You can’t perform that action at this time.
0 commit comments