Skip to content

Commit

Permalink
Merge pull request #42470 from m-kuhn/fix_property
Browse files Browse the repository at this point in the history
Fix invalid cast of QgsProperty as bool to store in strings
  • Loading branch information
m-kuhn committed Mar 25, 2021
2 parents 8e8febb + 5217d17 commit a973a77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/vectortile/qgsmapboxglstyleconverter.cpp
Expand Up @@ -1444,7 +1444,7 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer,
if ( labelSettings.placement == QgsPalLayerSettings::Curved )
{
QPointF textOffset;
QString textOffsetProperty;
QgsProperty textOffsetProperty;
if ( jsonLayout.contains( QStringLiteral( "text-offset" ) ) )
{
const QVariant jsonTextOffset = jsonLayout.value( QStringLiteral( "text-offset" ) );
Expand All @@ -1460,7 +1460,7 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer,
}
else
{
ddLabelProperties.setProperty( QgsPalLayerSettings::LabelDistance, QStringLiteral( "with_variable('text_size',%2,abs(array_get(%1,1))*@text_size-@text_size)" ).arg( textOffsetProperty, textSizeProperty.asExpression() ) );
ddLabelProperties.setProperty( QgsPalLayerSettings::LabelDistance, QStringLiteral( "with_variable('text_size',%2,abs(array_get(%1,1))*@text_size-@text_size)" ).arg( textOffsetProperty.asExpression(), textSizeProperty.asExpression() ) );
}
ddLabelProperties.setProperty( QgsPalLayerSettings::LinePlacementOptions, QStringLiteral( "if(array_get(%1,1)>0,'BL','AL')" ).arg( textOffsetProperty ) );
break;
Expand All @@ -1481,7 +1481,7 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer,
labelSettings.distUnits = context.targetUnit();
labelSettings.dist = std::abs( textOffset.y() ) - textSize;
labelSettings.lineSettings().setPlacementFlags( textOffset.y() > 0.0 ? QgsLabeling::BelowLine : QgsLabeling::AboveLine );
if ( textSizeProperty && textOffsetProperty.isEmpty() )
if ( textSizeProperty && !textOffsetProperty )
{
ddLabelProperties.setProperty( QgsPalLayerSettings::LabelDistance, QStringLiteral( "with_variable('text_size',%2,%1*@text_size-@text_size)" ).arg( std::abs( textOffset.y() / textSize ) ).arg( textSizeProperty.asExpression() ) );
}
Expand Down

0 comments on commit a973a77

Please sign in to comment.