Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 3, 2021
1 parent 42aa3b5 commit 044c97b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/gui/layertree/qgslayertreeviewdefaultactions.cpp
Expand Up @@ -304,8 +304,6 @@ void QgsLayerTreeViewDefaultActions::zoomToLayer( QgsMapCanvas *canvas )
void QgsLayerTreeViewDefaultActions::zoomToLayers( QgsMapCanvas *canvas )
{
const QList<QgsMapLayer *> layers = mView->selectedLayers();
// if ( layers.isEmpty() )
// return;

zoomToLayers( canvas, layers );
}
Expand Down Expand Up @@ -375,7 +373,7 @@ void QgsLayerTreeViewDefaultActions::zoomToLayers( QgsMapCanvas *canvas, const Q
QgsRectangle extent;
extent.setMinimal();

if ( layers.size() >= 1 )
if ( !layers.empty() )
{
for ( int i = 0; i < layers.size(); ++i )
{
Expand Down Expand Up @@ -406,7 +404,7 @@ void QgsLayerTreeViewDefaultActions::zoomToLayers( QgsMapCanvas *canvas, const Q
}

// If no layer is selected, use current layer
else
else if ( mView->currentLayer() )
{
QgsRectangle layerExtent = mView->currentLayer()->extent();
layerExtent = canvas->mapSettings().layerExtentToOutputExtent( mView->currentLayer(), layerExtent );
Expand Down

0 comments on commit 044c97b

Please sign in to comment.