Skip to content

Commit

Permalink
Fix for save and read layer properties
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15849 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 29, 2011
1 parent 326d7a7 commit f1b621b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/core/qgsmaplayer.cpp
Expand Up @@ -846,7 +846,10 @@ void QgsMapLayer::readCustomProperties( const QDomNode& layerNode, const QString
if ( propsNode.isNull() ) // no properties stored...
return;

mCustomProperties.clear();
if ( keyStartsWith.isEmpty() )
{
mCustomProperties.clear();
}

QDomNodeList nodes = propsNode.childNodes();

Expand All @@ -869,6 +872,13 @@ void QgsMapLayer::readCustomProperties( const QDomNode& layerNode, const QString

void QgsMapLayer::writeCustomProperties( QDomNode & layerNode, QDomDocument & doc ) const
{
//remove already existing <customproperties> tags
QDomNodeList propertyList = layerNode.toElement().elementsByTagName( "customproperties" );
for ( int i = 0; i < propertyList.size(); ++i )
{
layerNode.removeChild( propertyList.at( i ) );
}

QDomElement propsElement = doc.createElement( "customproperties" );

for ( QMap<QString, QVariant>::const_iterator it = mCustomProperties.constBegin(); it != mCustomProperties.constEnd(); ++it )
Expand Down

0 comments on commit f1b621b

Please sign in to comment.