Skip to content
Permalink
Browse files

made copy/paste style aware of scale based visibility (fixes #13746)

  • Loading branch information
SebDieBln committed Nov 19, 2015
1 parent e3489e0 commit a5b2a069814d31003ef19ffa259bce6b6f27b661
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/app/qgisapp.cpp
@@ -6808,6 +6808,10 @@ void QgisApp::copyStyle( QgsMapLayer * sourceLayer )
rootNode.setAttribute( "version", QString( "%1" ).arg( QGis::QGIS_VERSION ) );
doc.appendChild( rootNode );

rootNode.setAttribute( "hasScaleBasedVisibilityFlag", selectionLayer->hasScaleBasedVisibility() ? 1 : 0 );
rootNode.setAttribute( "minimumScale", QString::number( selectionLayer->minimumScale() ) );
rootNode.setAttribute( "maximumScale", QString::number( selectionLayer->maximumScale() ) );

/*
* Check to see if the layer is vector - in which case we should also copy its geometryType
* to avoid eventually pasting to a layer with a different geometry
@@ -6889,6 +6893,10 @@ void QgisApp::pasteStyle( QgsMapLayer * destinationLayer )
return;
}

selectionLayer->setScaleBasedVisibility( rootNode.attribute( "hasScaleBasedVisibilityFlag" ).toInt() == 1 );
selectionLayer->setMinimumScale( rootNode.attribute( "minimumScale" ).toFloat() );
selectionLayer->setMaximumScale( rootNode.attribute( "maximumScale" ).toFloat() );

mLayerTreeView->refreshLayerSymbology( selectionLayer->id() );
mMapCanvas->clearCache();
mMapCanvas->refresh();

0 comments on commit a5b2a06

Please sign in to comment.
You can’t perform that action at this time.