Skip to content

Commit

Permalink
enable Identify tool if a non-geometrical layer is selected but ident…
Browse files Browse the repository at this point in the history
…ify mode is not active layer (#41240)
  • Loading branch information
3nids committed Jan 29, 2021
1 parent 7b28cc6 commit 2c593a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/qgisapp.cpp
Expand Up @@ -14622,14 +14622,16 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
}
}

bool identifyModeIsActiveLayer = QgsSettings().enumValue( QStringLiteral( "/Map/identifyMode" ), QgsMapToolIdentify::ActiveLayer ) == QgsMapToolIdentify::ActiveLayer;

if ( !layer )
{
mMenuSelect->setEnabled( false );
mActionSelectFeatures->setEnabled( false );
mActionSelectPolygon->setEnabled( false );
mActionSelectFreehand->setEnabled( false );
mActionSelectRadius->setEnabled( false );
mActionIdentify->setEnabled( QgsSettings().enumValue( QStringLiteral( "/Map/identifyMode" ), QgsMapToolIdentify::ActiveLayer ) != QgsMapToolIdentify::ActiveLayer );
mActionIdentify->setEnabled( !identifyModeIsActiveLayer );
mActionSelectByExpression->setEnabled( false );
mActionSelectByForm->setEnabled( false );
mActionLabeling->setEnabled( false );
Expand Down Expand Up @@ -14782,7 +14784,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionSelectPolygon->setEnabled( isSpatial );
mActionSelectFreehand->setEnabled( isSpatial );
mActionSelectRadius->setEnabled( isSpatial );
mActionIdentify->setEnabled( isSpatial );
mActionIdentify->setEnabled( isSpatial || !identifyModeIsActiveLayer );
mActionSelectByExpression->setEnabled( true );
mActionSelectByForm->setEnabled( true );
mActionOpenTable->setEnabled( true );
Expand Down Expand Up @@ -15103,9 +15105,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
//but turn off if data provider exists and has no Identify capabilities
mActionIdentify->setEnabled( true );

QgsSettings settings;
QgsMapToolIdentify::IdentifyMode identifyMode = settings.enumValue( QStringLiteral( "Map/identifyMode" ), QgsMapToolIdentify::ActiveLayer );
if ( identifyMode == QgsMapToolIdentify::ActiveLayer )
if ( identifyModeIsActiveLayer )
{
if ( dprovider )
{
Expand Down

0 comments on commit 2c593a6

Please sign in to comment.