Skip to content

Commit fbb3dc5

Browse files
committed
Merge pull request #2487 from SebDieBln/CopyPasteScaleBasedVisibility
Make copy/paste style aware of scale based visibility (fixes #13746)
2 parents d795e50 + a5b2a06 commit fbb3dc5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/app/qgisapp.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -6808,6 +6808,10 @@ void QgisApp::copyStyle( QgsMapLayer * sourceLayer )
68086808
rootNode.setAttribute( "version", QString( "%1" ).arg( QGis::QGIS_VERSION ) );
68096809
doc.appendChild( rootNode );
68106810

6811+
rootNode.setAttribute( "hasScaleBasedVisibilityFlag", selectionLayer->hasScaleBasedVisibility() ? 1 : 0 );
6812+
rootNode.setAttribute( "minimumScale", QString::number( selectionLayer->minimumScale() ) );
6813+
rootNode.setAttribute( "maximumScale", QString::number( selectionLayer->maximumScale() ) );
6814+
68116815
/*
68126816
* Check to see if the layer is vector - in which case we should also copy its geometryType
68136817
* to avoid eventually pasting to a layer with a different geometry
@@ -6889,6 +6893,10 @@ void QgisApp::pasteStyle( QgsMapLayer * destinationLayer )
68896893
return;
68906894
}
68916895

6896+
selectionLayer->setScaleBasedVisibility( rootNode.attribute( "hasScaleBasedVisibilityFlag" ).toInt() == 1 );
6897+
selectionLayer->setMinimumScale( rootNode.attribute( "minimumScale" ).toFloat() );
6898+
selectionLayer->setMaximumScale( rootNode.attribute( "maximumScale" ).toFloat() );
6899+
68926900
mLayerTreeView->refreshLayerSymbology( selectionLayer->id() );
68936901
mMapCanvas->clearCache();
68946902
mMapCanvas->refresh();

0 commit comments

Comments
 (0)