Skip to content

Commit 613f304

Browse files
authoredJun 7, 2019
Merge pull request #30098 from elpaso/bugfix-gh30050-gpkg-drag-and-drop
Get raster layer name when d&d gpkg, also open vectors in addition to…
2 parents 96c3357 + c5f7e30 commit 613f304

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5000,7 +5000,17 @@ QList< QgsMapLayer * > QgisApp::askUserForGDALSublayers( QgsRasterLayer *layer )
50005000
// for hdf4 it would be best to get description, because the subdataset_index is not very practical
50015001
if ( name.startsWith( QLatin1String( "netcdf" ), Qt::CaseInsensitive ) ||
50025002
name.startsWith( QLatin1String( "hdf" ), Qt::CaseInsensitive ) )
5003+
{
50035004
name = name.mid( name.indexOf( path ) + path.length() + 1 );
5005+
}
5006+
else if ( name.startsWith( QLatin1String( "GPKG" ), Qt::CaseInsensitive ) )
5007+
{
5008+
const auto parts { name.split( ':' ) };
5009+
if ( parts.count() >= 3 )
5010+
{
5011+
name = parts.at( parts.count( ) - 1 );
5012+
}
5013+
}
50045014
else
50055015
{
50065016
// remove driver name and file name
@@ -6498,7 +6508,7 @@ bool QgisApp::openLayer( const QString &fileName, bool allowInteractive )
64986508
}
64996509

65006510
// try as a vector
6501-
if ( !ok )
6511+
if ( !ok || fileName.endsWith( QLatin1String( ".gpkg" ), Qt::CaseInsensitive ) )
65026512
{
65036513
if ( allowInteractive )
65046514
{

0 commit comments

Comments
 (0)
Please sign in to comment.