Skip to content

Commit

Permalink
[labeling] When a layer is set to "blocking" label mode, correctly
Browse files Browse the repository at this point in the history
handle data defined "is obstacle" and "priority" settings
  • Loading branch information
nyalldawson committed Dec 20, 2018
1 parent 5cbf95a commit b46f499
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/core/qgsvectorlayerlabelprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b46f499

Please sign in to comment.