Skip to content
Permalink
Browse files

Fix invalid cast of QgsProperty as bool to store in strings

Followup #42456
  • Loading branch information
m-kuhn committed Mar 25, 2021
1 parent 9b07d95 commit 80dba9dddc24d9d5d727b407b1120271bd002f95
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/core/vectortile/qgsmapboxglstyleconverter.cpp
@@ -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" ) );
@@ -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;
@@ -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 )
{
ddLabelProperties.setProperty( QgsPalLayerSettings::LabelDistance, QStringLiteral( "with_variable('text_size',%2,%1*@text_size-@text_size)" ).arg( std::abs( textOffset.y() / textSize ) ).arg( textSizeProperty.asExpression() ) );
}

0 comments on commit 80dba9d

Please sign in to comment.