Skip to content

Commit 030b234

Browse files
committedAug 9, 2017
Initial support for extension-based scan on multiple layers
1 parent e19c60b commit 030b234

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed
 

‎src/providers/ogr/qgsogrdataitems.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,17 @@ QGISEXTERN QgsDataItem *dataItem( QString path, QgsDataItem *parentItem )
336336
OGR_DS_Destroy( hDataSource );
337337
}
338338
}
339-
// add the item
340-
// TODO: how to handle collections?
341-
QgsLayerItem *item = new QgsOgrLayerItem( parentItem, name, path, path, QgsLayerItem::Vector );
339+
// Handle collections
340+
// Check if the layer has sublayers by comparing the extension
341+
QgsDataItem *item;
342+
QStringList multipleLayersExtensions;
343+
// TODO: add more formats here!
344+
multipleLayersExtensions << QLatin1String( "gpkg" ) << QLatin1String( "sqlite" );
345+
if ( ! multipleLayersExtensions.contains( suffix ) )
346+
item = new QgsOgrLayerItem( parentItem, name, path, path, QgsLayerItem::Vector );
347+
else
348+
item = new QgsOgrDataCollectionItem( parentItem, name, path );
349+
342350
if ( item )
343351
return item;
344352
}

0 commit comments

Comments
 (0)
Please sign in to comment.