Skip to content

Commit

Permalink
Fix loading older stored interpolated line renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 21, 2021
1 parent a76c2ed commit 7d71baa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/symbology/qgssymbollayerutils.cpp
Expand Up @@ -1197,7 +1197,17 @@ QgsSymbolLayer *QgsSymbolLayerUtils::loadSymbolLayer( QDomElement &element, cons
const QDomElement ddProps = element.firstChildElement( QStringLiteral( "data_defined_properties" ) );
if ( !ddProps.isNull() )
{
const QgsPropertyCollection prevProperties = layer->dataDefinedProperties();
layer->dataDefinedProperties().readXml( ddProps, QgsSymbolLayer::propertyDefinitions() );

// some symbol layers will be created with data defined properties by default -- we want to retain
// these if they weren't restored from the xml
const QSet< int > oldKeys = prevProperties.propertyKeys();
for ( int key : oldKeys )
{
if ( !layer->dataDefinedProperties().propertyKeys().contains( key ) )
layer->setDataDefinedProperty( static_cast< QgsSymbolLayer::Property >( key ), prevProperties.property( key ) );
}
}

return layer;
Expand Down

0 comments on commit 7d71baa

Please sign in to comment.