mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Don't require a connection to a geopackage for data item
'create new layer' to function
This commit is contained in:
parent
581d0d30ca
commit
ef7cc49c64
@ -505,21 +505,11 @@ void QgsGeoPackageCollectionItem::deleteConnection()
|
||||
void QgsGeoPackageCollectionItem::addTable()
|
||||
{
|
||||
QgsNewGeoPackageLayerDialog dialog( nullptr );
|
||||
QFileInfo fileInfo( mPath );
|
||||
QString connName = fileInfo.fileName();
|
||||
QgsOgrDbConnection connection( connName, QStringLiteral( "GPKG" ) );
|
||||
if ( ! connection.path().isEmpty() )
|
||||
dialog.setDatabasePath( mPath );
|
||||
dialog.setCrs( QgsProject::instance()->defaultCrsForNewLayers() );
|
||||
if ( dialog.exec() == QDialog::Accepted )
|
||||
{
|
||||
dialog.setDatabasePath( connection.path() );
|
||||
dialog.setCrs( QgsProject::instance()->defaultCrsForNewLayers() );
|
||||
if ( dialog.exec() == QDialog::Accepted )
|
||||
{
|
||||
refreshConnections();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsDebugMsg( QStringLiteral( "Cannot add Table: connection %1 does not exist or the path is empty!" ).arg( connName ) );
|
||||
refreshConnections();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user