Skip to content

Commit

Permalink
made copy/paste style aware of scale based visibility (fixes #13746)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDieBln committed Nov 19, 2015
1 parent e3489e0 commit a5b2a06
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit a5b2a06

Please sign in to comment.