Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix D&D GPKG from browser
Fixes #43129
  • Loading branch information
elpaso authored and nyalldawson committed May 28, 2021
1 parent 3b612b0 commit 32af68f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -5412,7 +5412,14 @@ static void setupVectorLayer( const QString &vectorLayerPath,
if ( elements.size() >= 4 && layer->name().compare( rawLayerName, Qt::CaseInsensitive ) != 0
&& layer->name().compare( subLayerNameFormatted, Qt::CaseInsensitive ) != 0 )
{
layer->setName( QStringLiteral( "%1 %2" ).arg( layer->name(), rawLayerName ) );
if ( layer->name().isEmpty( ) )
{
layer->setName( rawLayerName );
}
else
{
layer->setName( QStringLiteral( "%1 %2" ).arg( layer->name(), rawLayerName ) );
}
}

// Systematically add a layername= option to OGR datasets in case
Expand Down
2 changes: 1 addition & 1 deletion src/core/providers/ogr/qgsgeopackagedataitems.cpp
Expand Up @@ -400,7 +400,7 @@ QgsMimeDataUtils::UriList QgsGeoPackageCollectionItem::mimeUris() const
{
QgsMimeDataUtils::Uri vectorUri;
vectorUri.providerKey = QStringLiteral( "ogr" );
vectorUri.uri = path();
vectorUri.uri = path().replace( QStringLiteral( "gpkg:/" ), QString() );
vectorUri.layerType = QStringLiteral( "vector" );
QgsMimeDataUtils::Uri rasterUri { vectorUri };
rasterUri.layerType = QStringLiteral( "raster" );
Expand Down

0 comments on commit 32af68f

Please sign in to comment.