Skip to content
Permalink
Browse files

When layer tree selection has a mix of different layer CRSes,

reflect this in the CRS sub menu instead of just showing the first
selected layer's CRS
  • Loading branch information
nyalldawson committed Sep 24, 2020
1 parent 9311368 commit d688090f6304bb354a96979c36bfb361f02e4f4f
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/app/qgsapplayertreeviewmenuprovider.cpp
@@ -331,10 +331,6 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
menu->addAction( tr( "Zoom to &Visible Scale" ), QgisApp::instance(), &QgisApp::zoomToLayerScale );

QMenu *menuSetCRS = new QMenu( tr( "Layer CRS" ), menu );
QAction *actionCurrentCrs = new QAction( layer->crs().isValid() ? layer->crs().userFriendlyIdentifier()
: tr( "No CRS" ), menuSetCRS );
actionCurrentCrs->setEnabled( false );
menuSetCRS->addAction( actionCurrentCrs );

const QList<QgsLayerTreeNode *> selectedNodes = mView->selectedNodes();
QgsCoordinateReferenceSystem layerCrs;
@@ -361,6 +357,12 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
}
}

QAction *actionCurrentCrs = new QAction( !allSameCrs ? tr( "Mixed CRS" )
: layer->crs().isValid() ? layer->crs().userFriendlyIdentifier()
: tr( "No CRS" ), menuSetCRS );
actionCurrentCrs->setEnabled( false );
menuSetCRS->addAction( actionCurrentCrs );

if ( allSameCrs && layerCrs.isValid() )
{
// assign layer crs to project

0 comments on commit d688090

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