Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TurboGraphxBeige authored and nyalldawson committed Feb 1, 2021
1 parent 34ef8e1 commit 3f5f8ff
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/app/qgisapp.cpp
Expand Up @@ -14628,13 +14628,8 @@ bool QgisApp::selectedLayersHaveSelection()
// If no selected layers, use active layer
if ( layers.size() == 0 )
{
QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( activeLayer() );

if ( layer && layer->selectedFeatureCount() == 0 )
return false;

if ( layer && layer->selectedFeatureCount() > 0 )
return true;
if ( QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( activeLayer() ) )
return layer->selectedFeatureCount() > 0;
}

for ( QgsMapLayer *mapLayer : layers )
Expand Down Expand Up @@ -14671,9 +14666,12 @@ bool QgisApp::selectedLayersHaveSpatial()

void QgisApp::activateDeactivateMultipleLayersRelatedActions()
{
mActionZoomToLayers->setEnabled( selectedLayersHaveSpatial() );
mActionZoomToSelected->setEnabled( selectedLayersHaveSelection() );
mActionPanToSelected->setEnabled( selectedLayersHaveSelection() );
const bool hasSpatial = selectedLayersHaveSpatial();
const bool hasSelection = selectedLayersHaveSelection();

mActionZoomToLayers->setEnabled( hasSpatial );
mActionZoomToSelected->setEnabled( hasSelection );
mActionPanToSelected->setEnabled( hasSpatial );
}

void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
Expand Down

0 comments on commit 3f5f8ff

Please sign in to comment.