[QGIS Commit] r15849 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Apr 29 03:29:23 EDT 2011


Author: mhugent
Date: 2011-04-29 00:29:23 -0700 (Fri, 29 Apr 2011)
New Revision: 15849

Modified:
   trunk/qgis/src/core/qgsmaplayer.cpp
Log:
Fix for save and read layer properties

Modified: trunk/qgis/src/core/qgsmaplayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsmaplayer.cpp	2011-04-29 00:12:34 UTC (rev 15848)
+++ trunk/qgis/src/core/qgsmaplayer.cpp	2011-04-29 07:29:23 UTC (rev 15849)
@@ -846,7 +846,10 @@
   if ( propsNode.isNull() ) // no properties stored...
     return;
 
-  mCustomProperties.clear();
+  if ( keyStartsWith.isEmpty() )
+  {
+    mCustomProperties.clear();
+  }
 
   QDomNodeList nodes = propsNode.childNodes();
 
@@ -869,6 +872,13 @@
 
 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 )



More information about the QGIS-commit mailing list