Skip to content
Permalink
Browse files
fix setting of type column for postgis tables with multiple geometry …
…columns

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8251 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Mar 19, 2008
1 parent 20d79c5 commit 1abef894a445dbaf99c8e7c843bb816a36551056
Showing with 15 additions and 18 deletions.
  1. +15 −18 src/app/qgsdbtablemodel.cpp
@@ -177,31 +177,28 @@ void QgsDbTableModel::setGeometryTypesForTable(const QString& schema, const QStr
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 "))
{
itemFromIndex(currentGeomColumnIndex)->setText(geomColText + " AS " + typeList.at(0));
}

for(int j = 1; j < typeList.size(); ++j)
{
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), "");
}
//todo: add correct type
addTableEntry(typeList.at(j), schema, table, geomColText + " AS " + typeList.at(j), "");
}
}
}

0 comments on commit 1abef89

Please sign in to comment.