[QGIS Commit] r8251 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Mar 19 14:06:22 EDT 2008


Author: jef
Date: 2008-03-19 14:06:22 -0400 (Wed, 19 Mar 2008)
New Revision: 8251

Modified:
   trunk/qgis/src/app/qgsdbtablemodel.cpp
Log:
fix setting of type column for postgis tables with multiple geometry columns

Modified: trunk/qgis/src/app/qgsdbtablemodel.cpp
===================================================================
--- trunk/qgis/src/app/qgsdbtablemodel.cpp	2008-03-19 18:01:15 UTC (rev 8250)
+++ trunk/qgis/src/app/qgsdbtablemodel.cpp	2008-03-19 18:06:22 UTC (rev 8251)
@@ -177,32 +177,29 @@
       continue;
     }
 
-    if(itemFromIndex(currentTableIndex)->text() == table)
+    if(itemFromIndex(currentTableIndex)->text() == table &&
+       (geomColText==attribute || geomColText.startsWith( attribute + " AS ") ) )
     {
       if(typeIsEmpty)
       {
         removeRow(i, indexFromItem(schemaItem));
         return;
       }
-      for(int j = 0; j < typeList.size(); ++j)
+
+      QGis::WKBTYPE wkbType = qgisTypeFromDbType(typeList.at(0));
+      QString iconPath = iconFilePathForType(wkbType);
+      itemFromIndex(currentTypeIndex)->setText(typeList.at(0)); //todo: add other rows
+      itemFromIndex(currentTypeIndex)->setIcon(QIcon(iconPath));
+      if(!geomColText.contains(" AS "))
       {
-        if( j==0 )
-        {
-          QGis::WKBTYPE wkbType = qgisTypeFromDbType(typeList.at(0));
-          QString iconPath = iconFilePathForType(wkbType);
-          itemFromIndex(currentTypeIndex)->setText(typeList.at(0)); //todo: add other rows
-          itemFromIndex(currentTypeIndex)->setIcon(QIcon(iconPath));
-          if(!geomColText.contains(" AS "))
-          {
-            itemFromIndex(currentGeomColumnIndex)->setText(geomColText + " AS " + typeList.at(0));
-          }
-        }
-        else
-        {
-          //todo: add correct type
-          addTableEntry(typeList.at(j), schema, table, geomColText + " AS " + typeList.at(j), ""); 
-        }
+        itemFromIndex(currentGeomColumnIndex)->setText(geomColText + " AS " + typeList.at(0));
       }
+
+      for(int j = 1; j < typeList.size(); ++j)
+      {
+        //todo: add correct type
+        addTableEntry(typeList.at(j), schema, table, geomColText + " AS " + typeList.at(j), ""); 
+      }
     }
   }
 }



More information about the QGIS-commit mailing list