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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Apr 30 02:47:46 EDT 2011


Author: mhugent
Date: 2011-04-29 23:47:46 -0700 (Fri, 29 Apr 2011)
New Revision: 15856

Modified:
   trunk/qgis/src/core/qgsmaplayer.cpp
Log:
Better fix for restoring custom layer properties

Modified: trunk/qgis/src/core/qgsmaplayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsmaplayer.cpp	2011-04-30 04:44:57 UTC (rev 15855)
+++ trunk/qgis/src/core/qgsmaplayer.cpp	2011-04-30 06:47:46 UTC (rev 15856)
@@ -846,8 +846,27 @@
   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();
   }
 



More information about the QGIS-commit mailing list