Skip to content
Permalink
Browse files

Optimization

  • Loading branch information
pblottiere committed Oct 15, 2020
1 parent ece1dfa commit a25a561b6d77dd171bf74853da4f3e18ac1e61b9
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/gui/qgsmaptip.cpp
@@ -217,11 +217,13 @@ QString QgsMapTip::fetchFeature( QgsMapLayer *layer, QgsPointXY &mapPosition, Qg
QgsRenderContext renderCtx = QgsRenderContext::fromMapSettings( mapCanvas->mapSettings() );
renderCtx.expressionContext() << QgsExpressionContextUtils::layerScope( vlayer );

bool filter = false;
std::unique_ptr< QgsFeatureRenderer > renderer;
if ( vlayer->renderer() )
{
renderer.reset( vlayer->renderer()->clone() );
renderer->startRender( renderCtx, vlayer->fields() );
filter = renderer->capabilities() & QgsFeatureRenderer::Filter;
}

QgsFeatureIterator it = vlayer->getFeatures( request );
@@ -232,7 +234,7 @@ QString QgsMapTip::fetchFeature( QgsMapLayer *layer, QgsPointXY &mapPosition, Qg
context.setFeature( feature );

renderCtx.expressionContext().setFeature( feature );
if ( renderer && !renderer->willRenderFeature( feature, renderCtx ) )
if ( filter && renderer && !renderer->willRenderFeature( feature, renderCtx ) )
{
continue;
}

0 comments on commit a25a561

Please sign in to comment.
You can’t perform that action at this time.