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
  • Loading branch information
nyalldawson committed Dec 20, 2018
1 parent 5cbf95a commit b46f49996e1f06f2e2933c3e9136cb0c4d1e6bcd
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 b46f499

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