Skip to content
Permalink
Browse files

[labeling] When a layer is set to "blocking" label mode, correctly

handle data defined "is obstacle" and "priority" settings

(cherry picked from commit b46f499)
  • Loading branch information
nyalldawson committed Dec 20, 2018
1 parent 381627e commit 711645003ed7421a55c090203a3b27016670a2c6
Showing with 18 additions and 15 deletions.
  1. +18 −15 src/core/qgsvectorlayerlabelprovider.cpp
@@ -134,28 +134,31 @@ bool QgsVectorLayerLabelProvider::prepare( const QgsRenderContext &context, QSet

lyr.mCurFields = mFields;

if ( lyr.drawLabels )
if ( lyr.drawLabels || lyr.obstacle )
{
// add field indices for label's text, from expression or field
if ( lyr.isExpression )
if ( lyr.drawLabels )
{
// prepare expression for use in QgsPalLayerSettings::registerFeature()
QgsExpression *exp = lyr.getLabelExpression();
exp->prepare( &context.expressionContext() );
if ( exp->hasEvalError() )
// add field indices for label's text, from expression or field
if ( lyr.isExpression )
{
QgsDebugMsgLevel( "Prepare error:" + exp->evalErrorString(), 4 );
// prepare expression for use in QgsPalLayerSettings::registerFeature()
QgsExpression *exp = lyr.getLabelExpression();
exp->prepare( &context.expressionContext() );
if ( exp->hasEvalError() )
{
QgsDebugMsgLevel( "Prepare error:" + exp->evalErrorString(), 4 );
}
Q_FOREACH ( const QString &name, exp->referencedColumns() )
{
QgsDebugMsgLevel( "REFERENCED COLUMN = " + name, 4 );
attributeNames.insert( name );
}
}
Q_FOREACH ( const QString &name, exp->referencedColumns() )
else
{
QgsDebugMsgLevel( "REFERENCED COLUMN = " + name, 4 );
attributeNames.insert( name );
attributeNames.insert( lyr.fieldName );
}
}
else
{
attributeNames.insert( lyr.fieldName );
}

lyr.dataDefinedProperties().prepare( context.expressionContext() );
// add field indices of data defined expression or field

0 comments on commit 7116450

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