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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Jun 23 05:15:03 EDT 2008


Author: jef
Date: 2008-06-23 05:15:03 -0400 (Mon, 23 Jun 2008)
New Revision: 8672

Modified:
   trunk/qgis/src/app/qgsdbtablemodel.cpp
Log:
fix #1130

Modified: trunk/qgis/src/app/qgsdbtablemodel.cpp
===================================================================
--- trunk/qgis/src/app/qgsdbtablemodel.cpp	2008-06-23 08:54:39 UTC (rev 8671)
+++ trunk/qgis/src/app/qgsdbtablemodel.cpp	2008-06-23 09:15:03 UTC (rev 8672)
@@ -93,14 +93,16 @@
   //find out schema name and table name
   QModelIndex schemaSibling = index.sibling(index.row(), 0);
   QModelIndex tableSibling = index.sibling(index.row(), 1);
+  QModelIndex geomSibling = index.sibling(index.row(), 3);
 
-  if(!schemaSibling.isValid() || !tableSibling.isValid())
+  if(!schemaSibling.isValid() || !tableSibling.isValid() || !geomSibling.isValid())
   {
     return;
   }
 
   QString schemaName = itemFromIndex(schemaSibling)->text();
-  QString tableName = itemFromIndex(tableSibling)->text(); 
+  QString tableName = itemFromIndex(tableSibling)->text();
+  QString geomName = itemFromIndex(geomSibling)->text();
 
   QList<QStandardItem*> schemaItems = findItems(schemaName, Qt::MatchExactly, 0);
   if(schemaItems.size() < 1)
@@ -113,6 +115,7 @@
 
   QModelIndex currentChildIndex;
   QModelIndex currentTableIndex;
+  QModelIndex currentGeomIndex;
 
   for(int i = 0; i < numChildren; ++i)
   {
@@ -127,8 +130,15 @@
       continue;
     }
 
-    if(itemFromIndex(currentTableIndex)->text() == tableName)
+    currentGeomIndex = currentChildIndex.sibling(i, 3);
+    if(!currentGeomIndex.isValid())
     {
+      continue;
+    }
+
+    if(itemFromIndex(currentTableIndex)->text() == tableName &&
+       itemFromIndex(currentGeomIndex)->text() == geomName )
+    {
       QModelIndex sqlIndex = currentChildIndex.sibling(i, 4);
       if(sqlIndex.isValid())
       {



More information about the QGIS-commit mailing list