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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jan 6 06:12:53 EST 2009


Author: mhugent
Date: 2009-01-06 06:12:53 -0500 (Tue, 06 Jan 2009)
New Revision: 9929

Modified:
   trunk/qgis/src/core/qgslabel.cpp
Log:
Fix for loading labels in postgis layers

Modified: trunk/qgis/src/core/qgslabel.cpp
===================================================================
--- trunk/qgis/src/core/qgslabel.cpp	2009-01-06 08:52:10 UTC (rev 9928)
+++ trunk/qgis/src/core/qgslabel.cpp	2009-01-06 11:12:53 UTC (rev 9929)
@@ -700,13 +700,18 @@
   {
     name = el.attribute( name );
 
-    int i;
-    for ( i = 0; i < mField.size() && mField[i].name() != name; i++ )
-      ;
+    QgsFieldMap::const_iterator field_it = mField.constBegin();
+    for(; field_it != mField.constEnd(); ++field_it)
+    {
+        if(field_it.value().name() == name)
+        {
+            break;
+        }
+    }
 
-    if ( i < mField.size() )
+    if ( field_it != mField.constEnd() )
     {
-      mLabelFieldIdx[attr] = i;
+      mLabelFieldIdx[attr] = field_it.key();
       return true;
     }
   }



More information about the QGIS-commit mailing list