Skip to content
Permalink
Browse files

Zoom to multiple selected layer(s) in layer tree

  • Loading branch information
TurboGraphxBeige authored and nyalldawson committed Jan 1, 2021
1 parent e0e21a7 commit 0874c57779f38419a6a8c292d6bb1a59d1a3399c
@@ -150,6 +150,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()

if ( layer && layer->isSpatial() )
{

QAction *zoomToLayer = actions->actionZoomToLayer( mCanvas, menu );
zoomToLayer->setEnabled( layer->isValid() );
menu->addAction( zoomToLayer );
@@ -91,7 +91,7 @@ QAction *QgsLayerTreeViewDefaultActions::actionShowFeatureCount( QObject *parent
QAction *QgsLayerTreeViewDefaultActions::actionZoomToLayer( QgsMapCanvas *canvas, QObject *parent )
{
QAction *a = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomToLayer.svg" ) ),
tr( "&Zoom to Layer" ), parent );
tr( "&Zoom to Layer(s)" ), parent );
a->setData( QVariant::fromValue( reinterpret_cast<void *>( canvas ) ) );
connect( a, &QAction::triggered, this, static_cast<void ( QgsLayerTreeViewDefaultActions::* )()>( &QgsLayerTreeViewDefaultActions::zoomToLayer ) );
return a;
@@ -283,12 +283,10 @@ void QgsLayerTreeViewDefaultActions::showFeatureCount()

void QgsLayerTreeViewDefaultActions::zoomToLayer( QgsMapCanvas *canvas )
{
QgsMapLayer *layer = mView->currentLayer();
if ( !layer )
QList<QgsMapLayer *> layers = mView->selectedLayers();
if ( layers.isEmpty() )
return;

QList<QgsMapLayer *> layers;
layers << layer;
zoomToLayers( canvas, layers );
}

@@ -1351,7 +1351,7 @@
<normaloff>:/images/themes/default/mActionZoomToLayer.svg</normaloff>:/images/themes/default/mActionZoomToLayer.svg</iconset>
</property>
<property name="text">
<string>Zoom to &amp;Layer</string>
<string>Zoom to &amp;Layer(s)</string>
</property>
</action>
<action name="mActionZoomToSelected">

0 comments on commit 0874c57

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