Skip to content
Permalink
Browse files

Better fix for restoring custom layer properties

git-svn-id: http://svn.osgeo.org/qgis/trunk@15856 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Apr 30, 2011
1 parent 3e74c57 commit 2b9c837736eaf631444fc53c8d5dfafdb7dadbbe
Showing with 20 additions and 1 deletion.
  1. +20 −1 src/core/qgsmaplayer.cpp
@@ -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();
}

0 comments on commit 2b9c837

Please sign in to comment.
You can’t perform that action at this time.