Skip to content

Commit 331f590

Browse files
committedFeb 7, 2019
[browser] Avoid always opening every file using gdal to test for
update capabilities This is no longer required - it was previously done in order to detect if the item should expose the SetCrs capability, but that's deprecated and unused. Fixes #16807, fixes #20411, and avoids QGIS opening every file encountered in the browser even when the Data Source setting is set to the default (fast) "Check Extension" setting only. (cherry picked from commit 2c64cec)
1 parent 964c99f commit 331f590

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed
 

‎src/providers/gdal/qgsgdaldataitems.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ QgsGdalLayerItem::QgsGdalLayerItem( QgsDataItem *parent,
4848
}
4949
else
5050
setState( Populated );
51-
52-
GDALAllRegister();
53-
gdal::dataset_unique_ptr hDS( GDALOpen( mPath.toUtf8().constData(), GA_Update ) );
54-
55-
if ( hDS )
56-
{
57-
mCapabilities |= SetCrs;
58-
}
5951
}
6052

6153

‎src/providers/ogr/qgsogrdataitems.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,30 +53,11 @@ QgsOgrLayerItem::QgsOgrLayerItem( QgsDataItem *parent,
5353
mIsSubLayer = isSubLayer;
5454
mToolTip = uri;
5555
setState( Populated ); // children are not expected
56-
57-
if ( mPath.endsWith( QLatin1String( ".shp" ), Qt::CaseInsensitive ) )
58-
{
59-
if ( OGRGetDriverCount() == 0 )
60-
{
61-
OGRRegisterAll();
62-
}
63-
gdal::dataset_unique_ptr hDataSource( GDALOpenEx( mPath.toUtf8().constData(), GDAL_OF_VECTOR | GDAL_OF_UPDATE, nullptr, nullptr, nullptr ) );
64-
if ( hDataSource )
65-
{
66-
mCapabilities |= SetCrs;
67-
}
68-
69-
// It it is impossible to assign a crs to an existing layer
70-
// No OGR_L_SetSpatialRef : http://trac.osgeo.org/gdal/ticket/4032
71-
}
7256
}
7357

7458

7559
bool QgsOgrLayerItem::setCrs( const QgsCoordinateReferenceSystem &crs )
7660
{
77-
if ( !( mCapabilities & SetCrs ) )
78-
return false;
79-
8061
QString layerName = mPath.left( mPath.indexOf( QLatin1String( ".shp" ), Qt::CaseInsensitive ) );
8162
QString wkt = crs.toWkt();
8263

0 commit comments

Comments
 (0)
Please sign in to comment.