Skip to content

Commit 1abef89

Browse files
author
jef
committed
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
1 parent 20d79c5 commit 1abef89

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

src/app/qgsdbtablemodel.cpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,31 +177,28 @@ void QgsDbTableModel::setGeometryTypesForTable(const QString& schema, const QStr
177177
continue;
178178
}
179179

180-
if(itemFromIndex(currentTableIndex)->text() == table)
180+
if(itemFromIndex(currentTableIndex)->text() == table &&
181+
(geomColText==attribute || geomColText.startsWith( attribute + " AS ") ) )
181182
{
182183
if(typeIsEmpty)
183184
{
184185
removeRow(i, indexFromItem(schemaItem));
185186
return;
186187
}
187-
for(int j = 0; j < typeList.size(); ++j)
188+
189+
QGis::WKBTYPE wkbType = qgisTypeFromDbType(typeList.at(0));
190+
QString iconPath = iconFilePathForType(wkbType);
191+
itemFromIndex(currentTypeIndex)->setText(typeList.at(0)); //todo: add other rows
192+
itemFromIndex(currentTypeIndex)->setIcon(QIcon(iconPath));
193+
if(!geomColText.contains(" AS "))
194+
{
195+
itemFromIndex(currentGeomColumnIndex)->setText(geomColText + " AS " + typeList.at(0));
196+
}
197+
198+
for(int j = 1; j < typeList.size(); ++j)
188199
{
189-
if( j==0 )
190-
{
191-
QGis::WKBTYPE wkbType = qgisTypeFromDbType(typeList.at(0));
192-
QString iconPath = iconFilePathForType(wkbType);
193-
itemFromIndex(currentTypeIndex)->setText(typeList.at(0)); //todo: add other rows
194-
itemFromIndex(currentTypeIndex)->setIcon(QIcon(iconPath));
195-
if(!geomColText.contains(" AS "))
196-
{
197-
itemFromIndex(currentGeomColumnIndex)->setText(geomColText + " AS " + typeList.at(0));
198-
}
199-
}
200-
else
201-
{
202-
//todo: add correct type
203-
addTableEntry(typeList.at(j), schema, table, geomColText + " AS " + typeList.at(j), "");
204-
}
200+
//todo: add correct type
201+
addTableEntry(typeList.at(j), schema, table, geomColText + " AS " + typeList.at(j), "");
205202
}
206203
}
207204
}

0 commit comments

Comments
 (0)