Skip to content

Commit

Permalink
If a layer's provider supports feature symbology, show a small summar…
Browse files Browse the repository at this point in the history
…y of the embedded symbol when identifying features
  • Loading branch information
nyalldawson committed Mar 6, 2021
1 parent f32d563 commit 4dd6a89
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/gui/qgsmaptoolidentify.cpp
Expand Up @@ -556,6 +556,8 @@ bool QgsMapToolIdentify::identifyVectorLayer( QList<QgsMapToolIdentify::Identify
temporalFilter = qobject_cast< const QgsVectorLayerTemporalProperties * >( layer->temporalProperties() )->createFilterString( temporalContext, identifyContext.temporalRange() );
}

const bool fetchFeatureSymbols = layer->dataProvider()->capabilities() & QgsVectorDataProvider::FeatureSymbology;

QApplication::setOverrideCursor( Qt::WaitCursor );

QMap< QString, QString > commonDerivedAttributes;
Expand Down Expand Up @@ -610,7 +612,7 @@ bool QgsMapToolIdentify::identifyVectorLayer( QList<QgsMapToolIdentify::Identify

QgsFeatureRequest featureRequest;
featureRequest.setFilterRect( r );
featureRequest.setFlags( QgsFeatureRequest::ExactIntersect );
featureRequest.setFlags( QgsFeatureRequest::ExactIntersect | ( fetchFeatureSymbols ? QgsFeatureRequest::EmbeddedSymbols : QgsFeatureRequest::Flags() ) );
if ( !temporalFilter.isEmpty() )
featureRequest.setFilterExpression( temporalFilter );

Expand Down Expand Up @@ -920,6 +922,11 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( const Qgs
}
}

if ( feature.embeddedSymbol() )
{
derivedAttributes.insert( tr( "Embedded Symbol" ), tr( "%1 (%2)" ).arg( QgsSymbol::symbolTypeToString( feature.embeddedSymbol()->type() ), feature.embeddedSymbol()->color().name() ) );
}

return derivedAttributes;
}

Expand Down

0 comments on commit 4dd6a89

Please sign in to comment.