Skip to content

Commit

Permalink
fix setting of type column for postgis tables with multiple geometry …
Browse files Browse the repository at this point in the history
…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 1abef89
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/app/qgsdbtablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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), "");
}
}
}
Expand Down

0 comments on commit 1abef89

Please sign in to comment.