Skip to content

Commit

Permalink
Better fix for restoring custom layer properties
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15856 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 30, 2011
1 parent 68a0ea1 commit 238b0de
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/core/qgsmaplayer.cpp
Expand Up @@ -846,7 +846,26 @@ void QgsMapLayer::readCustomProperties( const QDomNode& layerNode, const QString
if ( propsNode.isNull() ) // no properties stored...
return;

if ( keyStartsWith.isEmpty() )
if ( !keyStartsWith.isEmpty() )
{
//remove old keys
QStringList keysToRemove;
QMap<QString, QVariant>::const_iterator pIt = mCustomProperties.constBegin();
for ( ; pIt != mCustomProperties.constEnd(); ++pIt )
{
if ( pIt.key().startsWith( keyStartsWith ) )
{
keysToRemove.push_back( pIt.key() );
}
}

QStringList::const_iterator sIt = keysToRemove.constBegin();
for ( ; sIt != keysToRemove.constEnd(); ++sIt )
{
mCustomProperties.remove( *sIt );
}
}
else
{
mCustomProperties.clear();
}
Expand Down

0 comments on commit 238b0de

Please sign in to comment.