Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Zoom to multiple selected layer(s) in layer tree
- Loading branch information
|
@@ -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 &Layer</string> |
|
|
<string>Zoom to &Layer(s)</string> |
|
|
</property> |
|
|
</action> |
|
|
<action name="mActionZoomToSelected"> |
|
|