@@ -177,31 +177,28 @@ void QgsDbTableModel::setGeometryTypesForTable(const QString& schema, const QStr
177
177
continue ;
178
178
}
179
179
180
- if (itemFromIndex (currentTableIndex)->text () == table)
180
+ if (itemFromIndex (currentTableIndex)->text () == table &&
181
+ (geomColText==attribute || geomColText.startsWith ( attribute + " AS " ) ) )
181
182
{
182
183
if (typeIsEmpty)
183
184
{
184
185
removeRow (i, indexFromItem (schemaItem));
185
186
return ;
186
187
}
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)
188
199
{
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), " " );
205
202
}
206
203
}
207
204
}
0 commit comments