Skip to content

Commit

Permalink
When layer tree selection has a mix of different layer CRSes,
Browse files Browse the repository at this point in the history
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 d688090
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/app/qgsapplayertreeviewmenuprovider.cpp
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit d688090

Please sign in to comment.