Skip to content
Permalink
Browse files
Fix behavior change in addRasterLayer() which leads to georeferencer …
…failing to loaded rasters
  • Loading branch information
nirvn committed Aug 25, 2021
1 parent 4444402 commit 7e52c7ecaba57812592c9b15eb159a821819c31f
Showing with 4 additions and 4 deletions.
  1. +2 −2 src/app/qgisapp.cpp
  2. +2 −2 src/app/qgisapp.h
@@ -13181,7 +13181,7 @@ void QgisApp::showLayoutManager()

QgsVectorLayer *QgisApp::addVectorLayer( const QString &vectorLayerPath, const QString &name, const QString &providerKey )
{
return addLayerPrivate< QgsVectorLayer >( QgsMapLayerType::VectorLayer, vectorLayerPath, name, providerKey, true );
return addLayerPrivate< QgsVectorLayer >( QgsMapLayerType::VectorLayer, vectorLayerPath, name, !providerKey.isEmpty() ? providerKey : QLatin1String( "ogr" ), true );
}

template<typename T>
@@ -15779,7 +15779,7 @@ void QgisApp::renameView()

QgsRasterLayer *QgisApp::addRasterLayer( QString const &uri, QString const &baseName, QString const &providerKey )
{
return addLayerPrivate< QgsRasterLayer >( QgsMapLayerType::RasterLayer, uri, baseName, providerKey, true );
return addLayerPrivate< QgsRasterLayer >( QgsMapLayerType::RasterLayer, uri, baseName, !providerKey.isEmpty() ? providerKey : QLatin1String( "gdal" ), true );
}

bool QgisApp::addRasterLayers( QStringList const &files, bool guiWarning )
@@ -1130,7 +1130,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
* parameter is used in the Map Legend so it should be formed in a meaningful
* way.
*/
QgsRasterLayer *addRasterLayer( QString const &uri, QString const &baseName, QString const &providerKey );
QgsRasterLayer *addRasterLayer( QString const &uri, QString const &baseName, QString const &providerKey = QLatin1String( "gdal" ) );

/**
* Add a vector layer directly without prompting user for location
@@ -1140,7 +1140,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
* parameter is used in the Map Legend so it should be formed in a meaningful
* way.
*/
QgsVectorLayer *addVectorLayer( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey );
QgsVectorLayer *addVectorLayer( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey = QLatin1String( "ogr" ) );

/**
* Adds a mesh layer directly without prompting user for location

0 comments on commit 7e52c7e

Please sign in to comment.