Skip to content

Commit

Permalink
Improve efficiency of load old props
Browse files Browse the repository at this point in the history
(cherry picked from commit 0b312d9)
  • Loading branch information
m-kuhn authored and nyalldawson committed Dec 22, 2020
1 parent 0ba9655 commit e54a2cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/symbology/qgssymbollayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void QgsSymbolLayer::restoreOldDataDefinedProperties( const QgsStringMap &string
QgsStringMap::const_iterator propIt = stringMap.constBegin();
for ( ; propIt != stringMap.constEnd(); ++propIt )
{
QgsProperty prop;
std::unique_ptr<QgsProperty> prop;
QString propertyName;

if ( propIt.key().endsWith( QLatin1String( "_dd_expression" ) ) )
Expand All @@ -374,7 +374,7 @@ void QgsSymbolLayer::restoreOldDataDefinedProperties( const QgsStringMap &string
//get data defined property name by stripping "_dd_expression" from property key
propertyName = propIt.key().left( propIt.key().length() - 14 );

prop = propertyFromMap( stringMap, propertyName );
prop = qgis::make_unique<QgsProperty>( propertyFromMap( stringMap, propertyName ) );
}
else if ( propIt.key().endsWith( QLatin1String( "_expression" ) ) )
{
Expand All @@ -383,7 +383,7 @@ void QgsSymbolLayer::restoreOldDataDefinedProperties( const QgsStringMap &string
//get data defined property name by stripping "_expression" from property key
propertyName = propIt.key().left( propIt.key().length() - 11 );

prop = QgsProperty::fromExpression( propIt.value() );
prop = qgis::make_unique<QgsProperty>( QgsProperty::fromExpression( propIt.value() ) );
}

if ( !prop || !OLD_PROPS.contains( propertyName ) )
Expand All @@ -400,7 +400,7 @@ void QgsSymbolLayer::restoreOldDataDefinedProperties( const QgsStringMap &string
key = QgsSymbolLayer::PropertyStrokeColor;
}

setDataDefinedProperty( key, prop );
setDataDefinedProperty( key, QgsProperty( *prop.get() ) );
}
}

Expand Down

0 comments on commit e54a2cd

Please sign in to comment.