QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
•All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qgsproviderregistry.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsproviderregistry.cpp - Singleton class for
3 registering data providers.
4 -------------------
5 begin : Sat Jan 10 2004
6 copyright : (C) 2004 by Gary E.Sherman
7 email : sherman at mrcc.com
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#include "qgsproviderregistry.h"
20
21#include "qgis.h"
22#include "qgsdataprovider.h"
23#include "qgsdataitemprovider.h"
24#include "qgslogger.h"
25#include "qgsmessagelog.h"
26#include "qgsprovidermetadata.h"
28#include "qgsproject.h"
31#include "providers/gdal/qgsgdalprovider.h"
32#include "providers/ogr/qgsogrprovidermetadata.h"
33#include "providers/ogr/qgsogrprovider.h"
34#include "providers/meshmemory/qgsmeshmemorydataprovider.h"
35
40
41#ifdef HAVE_EPT
42#include "providers/ept/qgseptprovider.h"
43#endif
44
45#ifdef HAVE_COPC
46#include "providers/copc/qgscopcprovider.h"
47#include "providers/vpc/qgsvirtualpointcloudprovider.h"
48#endif
49
50#include "qgsruntimeprofiler.h"
51#include "qgsfileutils.h"
52
53#ifdef HAVE_STATIC_PROVIDERS
54#include "qgswmsprovider.h"
55#include "qgswcsprovider.h"
56#include "qgsdelimitedtextprovider.h"
57#include "qgsafsprovider.h"
58#include "qgsamsprovider.h"
59#ifdef HAVE_SPATIALITE
60#include "qgsspatialiteprovider.h"
61#include "qgswfsprovider.h"
62#include "qgswfsprovidermetadata.h"
63#include "qgsoapifprovider.h"
64#include "qgsvirtuallayerprovider.h"
65#endif
66#ifdef HAVE_POSTGRESQL
67#include "qgspostgresprovider.h"
68#endif
69#endif
70
71#include <QString>
72#include <QDir>
73#include <QLibrary>
74#include <QRegularExpression>
75
76static QgsProviderRegistry *sInstance = nullptr;
77
79{
80 if ( !sInstance )
81 {
82 static QMutex sMutex;
83 const QMutexLocker locker( &sMutex );
84 if ( !sInstance )
85 {
86 sInstance = new QgsProviderRegistry( pluginPath );
87 }
88 }
89 return sInstance;
90} // QgsProviderRegistry::instance
91
92
101static
102QgsProviderMetadata *findMetadata_( const QgsProviderRegistry::Providers &metaData,
103 const QString &providerKey )
104{
105 // first do case-sensitive match
106 const QgsProviderRegistry::Providers::const_iterator i =
107 metaData.find( providerKey );
108
109 if ( i != metaData.end() )
110 {
111 return i->second;
112 }
113
114 // fallback to case-insensitive match
115 for ( auto it = metaData.begin(); it != metaData.end(); ++it )
116 {
117 if ( providerKey.compare( it->first, Qt::CaseInsensitive ) == 0 )
118 return it->second;
119 }
120
121 return nullptr;
122}
123
124QgsProviderRegistry::QgsProviderRegistry( const QString &pluginPath )
125{
126 // At startup, examine the libs in the qgis/lib dir and store those that
127 // are a provider shared lib
128 // check all libs in the current plugin directory and get name and descriptions
129 //TODO figure out how to register and identify data source plugin for a specific
130 //TODO layer type
131#if 0
132 char **argv = qApp->argv();
133 QString appDir = argv[0];
134 int bin = appDir.findRev( "/bin", -1, false );
135 QString baseDir = appDir.left( bin );
136 QString mLibraryDirectory = baseDir + "/lib";
137#endif
138
139 const QgsScopedRuntimeProfile profile( QObject::tr( "Initialize data providers" ) );
140 mLibraryDirectory.setPath( pluginPath );
141 init();
142}
143
145class PdalUnusableUriHandlerInterface : public QgsProviderRegistry::UnusableUriHandlerInterface
146{
147 public:
148 bool matchesUri( const QString &uri ) const override
149 {
150 const QFileInfo fi( uri );
151 if ( fi.suffix().compare( QLatin1String( "las" ), Qt::CaseInsensitive ) == 0 || fi.suffix().compare( QLatin1String( "laz" ), Qt::CaseInsensitive ) == 0 )
152 return true;
153
154 return false;
155 }
156
157 QgsProviderRegistry::UnusableUriDetails details( const QString &uri ) const override
158 {
160 QObject::tr( "LAS and LAZ files cannot be opened by this QGIS install." ),
161 QList<Qgis::LayerType>() << Qgis::LayerType::PointCloud );
162
163#ifdef Q_OS_WIN
164 res.detailedWarning = QObject::tr( "The installer used to install this version of QGIS does "
165 "not include the PDAL library required for opening LAS and LAZ point clouds. Please "
166 "obtain one of the alternative installers from https://qgis.org which has point "
167 "cloud support enabled." );
168#else
169 res.detailedWarning = QObject::tr( "This QGIS build does not include the PDAL library dependency required for opening LAS or LAZ point clouds." );
170#endif
171 return res;
172 }
173};
175
176void QgsProviderRegistry::init()
177{
178 // add static providers
179 {
180 const QgsScopedRuntimeProfile profile( QObject::tr( "Create memory layer provider" ) );
181 mProviders[ QgsMemoryProvider::providerKey() ] = new QgsMemoryProviderMetadata();
182 }
183 {
184 const QgsScopedRuntimeProfile profile( QObject::tr( "Create mesh memory layer provider" ) );
185 mProviders[ QgsMeshMemoryDataProvider::providerKey() ] = new QgsMeshMemoryProviderMetadata();
186 }
187 {
188 const QgsScopedRuntimeProfile profile( QObject::tr( "Create GDAL provider" ) );
189 mProviders[ QgsGdalProvider::providerKey() ] = new QgsGdalProviderMetadata();
190 }
191 {
192 const QgsScopedRuntimeProfile profile( QObject::tr( "Create OGR provider" ) );
193 mProviders[ QgsOgrProvider::providerKey() ] = new QgsOgrProviderMetadata();
194 }
195 {
196 const QgsScopedRuntimeProfile profile( QObject::tr( "Create vector tile providers" ) );
197 QgsProviderMetadata *vt = new QgsVectorTileProviderMetadata();
198 mProviders[ vt->key() ] = vt;
199 vt = new QgsXyzVectorTileDataProviderMetadata();
200 mProviders[ vt->key() ] = vt;
201 vt = new QgsVtpkVectorTileDataProviderMetadata();
202 mProviders[ vt->key() ] = vt;
203 vt = new QgsArcGisVectorTileServiceDataProviderMetadata();
204 mProviders[ vt->key() ] = vt;
205 vt = new QgsMbTilesVectorTileDataProviderMetadata();
206 mProviders[ vt->key() ] = vt;
207 }
208#ifdef HAVE_EPT
209 {
210 const QgsScopedRuntimeProfile profile( QObject::tr( "Create EPT point cloud provider" ) );
211 QgsProviderMetadata *pc = new QgsEptProviderMetadata();
212 mProviders[ pc->key() ] = pc;
213 }
214#endif
215#ifdef HAVE_COPC
216 {
217 const QgsScopedRuntimeProfile profile( QObject::tr( "Create COPC point cloud provider" ) );
218 QgsProviderMetadata *pc = new QgsCopcProviderMetadata();
219 mProviders[ pc->key() ] = pc;
220 }
221 {
222 const QgsScopedRuntimeProfile profile( QObject::tr( "Create Virtual point cloud provider" ) );
223 QgsProviderMetadata *pc = new QgsVirtualPointCloudProviderMetadata();
224 mProviders[ pc->key() ] = pc;
225 }
226#endif
227 registerUnusableUriHandler( new PdalUnusableUriHandlerInterface() );
228
229#ifdef HAVE_STATIC_PROVIDERS
230 mProviders[ QgsWmsProvider::providerKey() ] = new QgsWmsProviderMetadata();
231 mProviders[ QgsWcsProvider::providerKey() ] = new QgsWcsProviderMetadata();
232 mProviders[ QgsDelimitedTextProvider::providerKey() ] = new QgsDelimitedTextProviderMetadata();
233 mProviders[ QgsAfsProvider::providerKey() ] = new QgsAfsProviderMetadata();
234 mProviders[ QgsAmsProvider::providerKey() ] = new QgsAmsProviderMetadata();
235#ifdef HAVE_SPATIALITE
236 mProviders[ QgsSpatiaLiteProvider::providerKey() ] = new QgsSpatiaLiteProviderMetadata();
237 mProviders[ QgsWFSProvider::providerKey() ] = new QgsWfsProviderMetadata();
238 mProviders[ QgsOapifProvider::providerKey() ] = new QgsOapifProviderMetadata();
239 mProviders[ QgsVirtualLayerProvider::providerKey() ] = new QgsVirtualLayerProviderMetadata();
240#endif
241#ifdef HAVE_POSTGRESQL
242 mProviders[ QgsPostgresProvider::providerKey() ] = new QgsPostgresProviderMetadata();
243#endif
244#endif
245
246 // add dynamic providers
247#ifdef HAVE_STATIC_PROVIDERS
248 QgsDebugMsgLevel( QStringLiteral( "Forced only static providers" ), 2 );
249#else
250 typedef QgsProviderMetadata *factory_function( );
251
252 mLibraryDirectory.setSorting( QDir::Name | QDir::IgnoreCase );
253 mLibraryDirectory.setFilter( QDir::Files | QDir::NoSymLinks );
254
255#if defined(Q_OS_WIN) || defined(__CYGWIN__)
256 mLibraryDirectory.setNameFilters( QStringList( "*.dll" ) );
257#elif defined(ANDROID)
258 mLibraryDirectory.setNameFilters( QStringList( "*provider_*.so" ) );
259#else
260 mLibraryDirectory.setNameFilters( QStringList( QStringLiteral( "*.so" ) ) );
261#endif
262
263 QgsDebugMsgLevel( QStringLiteral( "Checking %1 for provider plugins" ).arg( mLibraryDirectory.path() ), 2 );
264
265 if ( mLibraryDirectory.count() == 0 )
266 {
267 QgsDebugError( QStringLiteral( "No dynamic QGIS data provider plugins found in:\n%1\n" ).arg( mLibraryDirectory.path() ) );
268 }
269
270 // provider file regex pattern, only files matching the pattern are loaded if the variable is defined
271 const QString filePattern = getenv( "QGIS_PROVIDER_FILE" );
272 QRegularExpression fileRegexp;
273 if ( !filePattern.isEmpty() )
274 {
275 fileRegexp.setPattern( filePattern );
276 }
277
278 typedef std::vector<QgsProviderMetadata *> *multiple_factory_function();
279
280 const auto constEntryInfoList = mLibraryDirectory.entryInfoList();
281 for ( const QFileInfo &fi : constEntryInfoList )
282 {
283 if ( !filePattern.isEmpty() )
284 {
285 if ( fi.fileName().indexOf( fileRegexp ) == -1 )
286 {
287 QgsDebugMsgLevel( "provider " + fi.fileName() + " skipped because doesn't match pattern " + filePattern, 2 );
288 continue;
289 }
290 }
291
292 // Always skip authentication methods
293 if ( fi.fileName().contains( QStringLiteral( "authmethod" ), Qt::CaseSensitivity::CaseInsensitive ) )
294 {
295 continue;
296 }
297
298 const QgsScopedRuntimeProfile profile( QObject::tr( "Load %1" ).arg( fi.fileName() ) );
299 QLibrary myLib( fi.filePath() );
300 if ( !myLib.load() )
301 {
302 QgsDebugError( QStringLiteral( "Checking %1: ...invalid (lib not loadable): %2" ).arg( myLib.fileName(), myLib.errorString() ) );
303 continue;
304 }
305
306 bool libraryLoaded { false };
307 QFunctionPointer func = myLib.resolve( QStringLiteral( "providerMetadataFactory" ).toLatin1().data() );
308 factory_function *function = reinterpret_cast< factory_function * >( cast_to_fptr( func ) );
309 if ( function )
310 {
312 if ( meta )
313 {
314 if ( findMetadata_( mProviders, meta->key() ) )
315 {
316 QgsDebugError( QStringLiteral( "Checking %1: ...invalid (key %2 already registered)" ).arg( myLib.fileName() ).arg( meta->key() ) );
317 delete meta;
318 continue;
319 }
320 // add this provider to the provider map
321 mProviders[meta->key()] = meta;
322 libraryLoaded = true;
323 }
324 }
325 else
326 {
327 QFunctionPointer multi_func = myLib.resolve( QStringLiteral( "multipleProviderMetadataFactory" ).toLatin1().data() );
328 multiple_factory_function *multi_function = reinterpret_cast< multiple_factory_function * >( cast_to_fptr( multi_func ) );
329 if ( multi_function )
330 {
331 std::vector<QgsProviderMetadata *> *metadatas = multi_function();
332 for ( const auto meta : *metadatas )
333 {
334 if ( findMetadata_( mProviders, meta->key() ) )
335 {
336 QgsDebugError( QStringLiteral( "Checking %1: ...invalid (key %2 already registered)" ).arg( myLib.fileName() ).arg( meta->key() ) );
337 delete meta;
338 continue;
339 }
340 // add this provider to the provider map
341 mProviders[meta->key()] = meta;
342 libraryLoaded = true;
343 }
344 delete metadatas;
345 }
346 }
347
348 if ( ! libraryLoaded )
349 {
350 QgsDebugMsgLevel( QStringLiteral( "Checking %1: ...invalid (no providerMetadataFactory method)" ).arg( myLib.fileName() ), 2 );
351 }
352 }
353
354#endif
355 QgsDebugMsgLevel( QStringLiteral( "Loaded %1 providers (%2) " ).arg( mProviders.size() ).arg( providerList().join( ';' ) ), 1 );
356
357 QStringList pointCloudWildcards;
358 QStringList pointCloudFilters;
359
360 QStringList vectorTileWildcards;
361 QStringList vectorTileFilters;
362
363 // now initialize all providers
364 for ( Providers::const_iterator it = mProviders.begin(); it != mProviders.end(); ++it )
365 {
366 const QString &key = it->first;
367
368 const QgsScopedRuntimeProfile profile( QObject::tr( "Initialize %1" ).arg( key ) );
369
370 QgsProviderMetadata *meta = it->second;
371
372 // now get vector file filters, if any
373 const QString fileVectorFilters = meta->filters( Qgis::FileFilterType::Vector );
374 if ( !fileVectorFilters.isEmpty() )
375 {
376 mVectorFileFilters += fileVectorFilters;
377 QgsDebugMsgLevel( QStringLiteral( "Checking %1: ...loaded OK (%2 file filters)" ).arg( key ).arg( fileVectorFilters.split( ";;" ).count() ), 2 );
378 }
379
380 // now get raster file filters, if any
381 const QString fileRasterFilters = meta->filters( Qgis::FileFilterType::Raster );
382 if ( !fileRasterFilters.isEmpty() )
383 {
384 QgsDebugMsgLevel( "raster filters: " + fileRasterFilters, 2 );
385 mRasterFileFilters += fileRasterFilters;
386 QgsDebugMsgLevel( QStringLiteral( "Checking %1: ...loaded OK (%2 file filters)" ).arg( key ).arg( fileRasterFilters.split( ";;" ).count() ), 2 );
387 }
388
389 // now get mesh file filters, if any
390 const QString fileMeshFilters = meta->filters( Qgis::FileFilterType::Mesh );
391 if ( !fileMeshFilters.isEmpty() )
392 {
393 mMeshFileFilters += fileMeshFilters;
394 QgsDebugMsgLevel( QStringLiteral( "Checking %1: ...loaded OK (%2 file mesh filters)" ).arg( key ).arg( mMeshFileFilters.split( ";;" ).count() ), 2 );
395
396 }
397
398 const QString fileMeshDatasetFilters = meta->filters( Qgis::FileFilterType::MeshDataset );
399 if ( !fileMeshDatasetFilters.isEmpty() )
400 {
401 mMeshDatasetFileFilters += fileMeshDatasetFilters;
402 QgsDebugMsgLevel( QStringLiteral( "Checking %1: ...loaded OK (%2 file dataset filters)" ).arg( key ).arg( mMeshDatasetFileFilters.split( ";;" ).count() ), 2 );
403 }
404
405 // now get point cloud file filters, if any
406 const QString filePointCloudFilters = meta->filters( Qgis::FileFilterType::PointCloud );
407 if ( !filePointCloudFilters.isEmpty() )
408 {
409 QgsDebugMsgLevel( "point cloud filters: " + filePointCloudFilters, 2 );
410
411#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
412 const QStringList filters = filePointCloudFilters.split( QStringLiteral( ";;" ), QString::SkipEmptyParts );
413#else
414 const QStringList filters = filePointCloudFilters.split( QStringLiteral( ";;" ), Qt::SkipEmptyParts );
415#endif
416 for ( const QString &filter : filters )
417 {
418 pointCloudFilters.append( filter );
419 pointCloudWildcards.append( QgsFileUtils::wildcardsFromFilter( filter ).split( ' ' ) );
420 }
421 }
422
423 // now get vector tile file filters, if any
425 if ( !fileVectorTileFilters.isEmpty() )
426 {
427 QgsDebugMsgLevel( "vector tile filters: " + fileVectorTileFilters, 2 );
428
429#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
430 const QStringList filters = fileVectorTileFilters.split( QStringLiteral( ";;" ), QString::SkipEmptyParts );
431#else
432 const QStringList filters = fileVectorTileFilters.split( QStringLiteral( ";;" ), Qt::SkipEmptyParts );
433#endif
434 for ( const QString &filter : filters )
435 {
436 vectorTileFilters.append( filter );
437 vectorTileWildcards.append( QgsFileUtils::wildcardsFromFilter( filter ).split( ' ' ) );
438 }
439 }
440
441 // call initProvider() - allows provider to register its services to QGIS
442 meta->initProvider();
443 }
444
445 if ( !pointCloudFilters.empty() )
446 {
447 pointCloudFilters.insert( 0, QObject::tr( "All Supported Files" ) + QStringLiteral( " (%1)" ).arg( pointCloudWildcards.join( ' ' ) ) );
448 pointCloudFilters.insert( 1, QObject::tr( "All Files" ) + QStringLiteral( " (*.*)" ) );
449 mPointCloudFileFilters = pointCloudFilters.join( QLatin1String( ";;" ) );
450 }
451
452 if ( !vectorTileFilters.empty() )
453 {
454 vectorTileFilters.insert( 0, QObject::tr( "All Supported Files" ) + QStringLiteral( " (%1)" ).arg( vectorTileWildcards.join( ' ' ) ) );
455 vectorTileFilters.insert( 1, QObject::tr( "All Files" ) + QStringLiteral( " (*.*)" ) );
456 mVectorTileFileFilters = vectorTileFilters.join( QLatin1String( ";;" ) );
457 }
458
459 // load database drivers (only OGR)
460 mDatabaseDrivers = QgsOgrProviderUtils::databaseDrivers();
461
462 // load directory drivers (only OGR)
463 mDirectoryDrivers = QgsOgrProviderUtils::directoryDrivers();
464
465 // load protocol drivers (only OGR)
466 mProtocolDrivers = QgsOgrProviderUtils::protocolDrivers();
467} // QgsProviderRegistry ctor
468
469
470// typedef for the unload dataprovider function
472
473void QgsProviderRegistry::clean()
474{
475 // avoid recreating a new project just to clean it
476 if ( QgsProject::sProject )
478
479 Providers::const_iterator it = mProviders.begin();
480
481 while ( it != mProviders.end() )
482 {
483 QgsDebugMsgLevel( QStringLiteral( "cleanup:%1" ).arg( it->first ), 5 );
484 it->second->cleanupProvider();
485 delete it->second;
486 ++it;
487 }
488 mProviders.clear();
489}
490
491bool QgsProviderRegistry::exists()
492{
493 return static_cast< bool >( sInstance );
494}
495
497{
498 qDeleteAll( mUnusableUriHandlers );
499
500 clean();
501 if ( sInstance == this )
502 sInstance = nullptr;
503}
504
505QString QgsProviderRegistry::library( QString const &providerKey ) const
506{
507 QgsProviderMetadata *md = findMetadata_( mProviders, providerKey );
508
509 if ( md )
510 {
512 return md->library();
514 }
515
516 return QString();
517}
518
519QString QgsProviderRegistry::pluginList( bool asHTML ) const
520{
521 Providers::const_iterator it = mProviders.begin();
522
523 if ( mProviders.empty() )
524 return QObject::tr( "No data provider plugins are available. No vector layers can be loaded" );
525
526 QString list;
527
528 if ( asHTML )
529 list += QLatin1String( "<ol>" );
530
531 while ( it != mProviders.end() )
532 {
533 if ( asHTML )
534 list += QLatin1String( "<li>" );
535
536 list += it->second->description();
537
538 if ( asHTML )
539 list += QLatin1String( "<br></li>" );
540 else
541 list += '\n';
542
543 ++it;
544 }
545
546 if ( asHTML )
547 list += QLatin1String( "</ol>" );
548
549 return list;
550}
551
553{
554 mLibraryDirectory = path;
555 clean();
556 init();
557}
558
560{
561 return mLibraryDirectory;
562}
563
564
565/* Copied from QgsVectorLayer::setDataProvider
566 * TODO: Make it work in the generic environment
567 *
568 * TODO: Is this class really the best place to put a data provider loader?
569 * It seems more sensible to provide the code in one place rather than
570 * in qgsrasterlayer, qgsvectorlayer, serversourceselect, etc.
571 */
572QgsDataProvider *QgsProviderRegistry::createProvider( QString const &providerKey, QString const &dataSource,
574 QgsDataProvider::ReadFlags flags )
575{
576 // XXX should I check for and possibly delete any pre-existing providers?
577 // XXX How often will that scenario occur?
578
579 QgsProviderMetadata *metadata = findMetadata_( mProviders, providerKey );
580 if ( !metadata )
581 {
582 QgsMessageLog::logMessage( QObject::tr( "Invalid data provider %1" ).arg( providerKey ) );
583 return nullptr;
584 }
585
586 return metadata->createProvider( dataSource, options, flags );
587}
588
589int QgsProviderRegistry::providerCapabilities( const QString &providerKey ) const
590{
591 const QList< QgsDataItemProvider * > itemProviders = dataItemProviders( providerKey );
593 //concat flags
594 for ( const QgsDataItemProvider *itemProvider : itemProviders )
595 {
596 ret = ret | itemProvider->capabilities();
597 }
598 return ret;
599}
600
601QVariantMap QgsProviderRegistry::decodeUri( const QString &providerKey, const QString &uri )
602{
603 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
604 if ( meta )
605 return meta->decodeUri( uri );
606 else
607 return QVariantMap();
608}
609
610QString QgsProviderRegistry::encodeUri( const QString &providerKey, const QVariantMap &parts )
611{
612 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
613 if ( meta )
614 return meta->encodeUri( parts );
615 else
616 return QString();
617}
618
619QString QgsProviderRegistry::absoluteToRelativeUri( const QString &providerKey, const QString &uri, const QgsReadWriteContext &context ) const
620{
621 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
622 if ( meta )
623 return meta->absoluteToRelativeUri( uri, context );
624 else
625 return uri;
626}
627
628QString QgsProviderRegistry::relativeToAbsoluteUri( const QString &providerKey, const QString &uri, const QgsReadWriteContext &context ) const
629{
630 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
631 if ( meta )
632 return meta->relativeToAbsoluteUri( uri, context );
633 else
634 return uri;
635}
636
638 const QString &uri,
639 const QgsFields &fields,
640 Qgis::WkbType wkbType,
642 bool overwrite, QMap<int, int> &oldToNewAttrIdxMap,
643 QString &errorMessage,
644 const QMap<QString, QVariant> *options )
645{
646 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
647 if ( meta )
648 return meta->createEmptyLayer( uri, fields, wkbType, srs, overwrite, oldToNewAttrIdxMap, errorMessage, options );
649 else
650 {
651 errorMessage = QObject::tr( "Unable to load %1 provider" ).arg( providerKey );
652 return Qgis::VectorExportResult::ErrorInvalidProvider;
653 }
654}
655
656QgsRasterDataProvider *QgsProviderRegistry::createRasterDataProvider( const QString &providerKey, const QString &uri, const QString &format,
657 int nBands, Qgis::DataType type, int width, int height,
658 double *geoTransform, const QgsCoordinateReferenceSystem &crs,
659 const QStringList &createOptions )
660{
661 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
662 if ( meta )
663 return meta->createRasterDataProvider( uri, format, nBands, type, width, height, geoTransform, crs, createOptions );
664 else
665 return nullptr;
666}
667
668QList<QPair<QString, QString> > QgsProviderRegistry::pyramidResamplingMethods( const QString &providerKey )
669{
670 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
671 if ( meta )
672 return meta->pyramidResamplingMethods();
673 else
674 return QList<QPair<QString, QString> >();
675}
676
677QList<QgsDataItemProvider *> QgsProviderRegistry::dataItemProviders( const QString &providerKey ) const
678{
679 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
680 if ( meta )
681 return meta->dataItemProviders();
682 else
683 return QList<QgsDataItemProvider *>();
684}
685
686int QgsProviderRegistry::listStyles( const QString &providerKey, const QString &uri, QStringList &ids, QStringList &names, QStringList &descriptions, QString &errCause )
687{
688 int res = -1;
689 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
690 if ( meta )
691 {
692 res = meta->listStyles( uri, ids, names, descriptions, errCause );
693 }
694 else
695 {
696 errCause = QObject::tr( "Unable to load %1 provider" ).arg( providerKey );
697 }
698 return res;
699}
700
701bool QgsProviderRegistry::styleExists( const QString &providerKey, const QString &uri, const QString &styleId, QString &errorCause )
702{
703 errorCause.clear();
704
705 if ( QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey ) )
706 {
707 return meta->styleExists( uri, styleId, errorCause );
708 }
709 else
710 {
711 errorCause = QObject::tr( "Unable to load %1 provider" ).arg( providerKey );
712 return false;
713 }
714}
715
716QString QgsProviderRegistry::getStyleById( const QString &providerKey, const QString &uri, const QString &styleId, QString &errCause )
717{
718 QString ret;
719 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
720 if ( meta )
721 {
722 ret = meta->getStyleById( uri, styleId, errCause );
723 }
724 else
725 {
726 errCause = QObject::tr( "Unable to load %1 provider" ).arg( providerKey );
727 }
728 return ret;
729}
730
731bool QgsProviderRegistry::deleteStyleById( const QString &providerKey, const QString &uri, const QString &styleId, QString &errCause )
732{
733 const bool ret( false );
734
735 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
736 if ( meta )
737 return meta->deleteStyleById( uri, styleId, errCause );
738 else
739 {
740 errCause = QObject::tr( "Unable to load %1 provider" ).arg( providerKey );
741 }
742 return ret;
743}
744
745bool QgsProviderRegistry::saveStyle( const QString &providerKey, const QString &uri, const QString &qmlStyle,
746 const QString &sldStyle, const QString &styleName, const QString &styleDescription,
747 const QString &uiFileContent, bool useAsDefault, QString &errCause )
748{
749 bool ret( false );
750 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
751 if ( meta )
752 ret = meta->saveStyle( uri, qmlStyle, sldStyle, styleName, styleDescription,
753 uiFileContent, useAsDefault, errCause );
754 else
755 {
756 errCause = QObject::tr( "Unable to load %1 provider" ).arg( providerKey );
757 }
758 return ret;
759}
760
761QString QgsProviderRegistry::loadStyle( const QString &providerKey, const QString &uri, QString &errCause )
762{
763 QString ret;
764 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
765 if ( meta )
766 ret = meta->loadStyle( uri, errCause );
767 else
768 {
769 errCause = QObject::tr( "Unable to load %1 provider" ).arg( providerKey );
770 }
771 return ret;
772}
773
774QString QgsProviderRegistry::loadStoredStyle( const QString &providerKey, const QString &uri, QString &styleName, QString &errCause )
775{
776 QString ret;
777 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
778 if ( meta )
779 ret = meta->loadStoredStyle( uri, styleName, errCause );
780 else
781 {
782 errCause = QObject::tr( "Unable to load %1 provider" ).arg( providerKey );
783 }
784 return ret;
785}
786
787bool QgsProviderRegistry::saveLayerMetadata( const QString &providerKey, const QString &uri, const QgsLayerMetadata &metadata, QString &errorMessage )
788{
789 errorMessage.clear();
790 if ( QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey ) )
791 return meta->saveLayerMetadata( uri, metadata, errorMessage );
792 else
793 {
794 throw QgsNotSupportedException( QObject::tr( "Unable to load %1 provider" ).arg( providerKey ) );
795 }
796}
797
798bool QgsProviderRegistry::createDb( const QString &providerKey, const QString &dbPath, QString &errCause )
799{
800 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
801 if ( meta )
802 return meta->createDb( dbPath, errCause );
803 else
804 {
805 errCause = QStringLiteral( "Resolving createDb(...) failed" );
806 return false;
807 }
808}
809
810QgsTransaction *QgsProviderRegistry::createTransaction( const QString &providerKey, const QString &connString )
811{
812 QgsProviderMetadata *meta = findMetadata_( mProviders, providerKey );
813 if ( meta )
814 return meta->createTransaction( connString );
815 else
816 return nullptr;
817}
818
819QWidget *QgsProviderRegistry::createSelectionWidget( const QString &providerKey,
820 QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
821{
822 Q_UNUSED( providerKey );
823 Q_UNUSED( parent );
824 Q_UNUSED( fl );
825 Q_UNUSED( widgetMode );
826 QgsDebugError( "deprecated call - use QgsGui::sourceSelectProviderRegistry()->createDataSourceWidget() instead" );
827 return nullptr;
828}
829
830QFunctionPointer QgsProviderRegistry::function( QString const &providerKey,
831 QString const &functionName ) const
832{
834 const QString lib = library( providerKey );
836 if ( lib.isEmpty() )
837 return nullptr;
838
839 QLibrary myLib( lib );
840
841 QgsDebugMsgLevel( "Library name is " + myLib.fileName(), 2 );
842
843 if ( myLib.load() )
844 {
845 return myLib.resolve( functionName.toLatin1().data() );
846 }
847 else
848 {
849 QgsDebugError( "Cannot load library: " + myLib.errorString() );
850 return nullptr;
851 }
852}
853
854QLibrary *QgsProviderRegistry::createProviderLibrary( QString const &providerKey ) const
855{
857 const QString lib = library( providerKey );
859 if ( lib.isEmpty() )
860 return nullptr;
861
862 std::unique_ptr< QLibrary > myLib( new QLibrary( lib ) );
863
864 QgsDebugMsgLevel( "Library name is " + myLib->fileName(), 2 );
865
866 if ( myLib->load() )
867 return myLib.release();
868
869 QgsDebugError( "Cannot load library: " + myLib->errorString() );
870
871 return nullptr;
872}
873
875{
876 QgsDebugError( "deprecated - use QgsGui::providerGuiRegistry() instead." );
877}
878
880{
881 if ( providerMetadata )
882 {
883 if ( mProviders.find( providerMetadata->key() ) == mProviders.end() )
884 {
885 mProviders[ providerMetadata->key() ] = providerMetadata;
886 return true;
887 }
888 else
889 {
890 QgsDebugMsgLevel( QStringLiteral( "Cannot register provider metadata: a provider with the same key (%1) was already registered!" ).arg( providerMetadata->key() ), 2 );
891 }
892 }
893 else
894 {
895 QgsDebugMsgLevel( QStringLiteral( "Trying to register a null metadata provider!" ), 2 );
896 }
897 return false;
898}
899
901{
902 return mVectorFileFilters;
903}
904
906{
907 return mRasterFileFilters;
908}
909
911{
912 return mMeshFileFilters;
913}
914
916{
917 return mMeshDatasetFileFilters;
918}
919
921{
922 return mPointCloudFileFilters;
923}
924
926{
927 return mVectorTileFileFilters;
928}
929
931{
932 return mDatabaseDrivers;
933}
934
936{
937 return mDirectoryDrivers;
938}
939
941{
942 return mProtocolDrivers;
943}
944
946{
947 QStringList lst;
948 for ( Providers::const_iterator it = mProviders.begin(); it != mProviders.end(); ++it )
949 {
950 lst.append( it->first );
951 }
952 return lst;
953}
954
956{
957 return findMetadata_( mProviders, providerKey );
958}
959
961{
962 QSet<QString> lst;
963 for ( Providers::const_iterator it = mProviders.begin(); it != mProviders.end(); ++it )
964 {
965 if ( it->second->supportedLayerTypes().contains( type ) )
966 lst.insert( it->first );
967 }
968 return lst;
969}
970
971QList<QgsProviderRegistry::ProviderCandidateDetails> QgsProviderRegistry::preferredProvidersForUri( const QString &uri ) const
972{
973 QList< QgsProviderRegistry::ProviderCandidateDetails > res;
974 int maxPriority = 0;
975 for ( auto it = mProviders.begin(); it != mProviders.end(); ++it )
976 {
977 if ( !( it->second->capabilities() & QgsProviderMetadata::PriorityForUri ) )
978 continue;
979
980 const int thisProviderPriority = it->second->priorityForUri( uri );
981 if ( thisProviderPriority == 0 )
982 continue;
983
984 if ( thisProviderPriority > maxPriority )
985 {
986 res.clear();
987 maxPriority = thisProviderPriority;
988 }
989 if ( thisProviderPriority == maxPriority )
990 {
991 res.append( ProviderCandidateDetails( it->second, it->second->validLayerTypesForUri( uri ) ) );
992 }
993 }
994 return res;
995}
996
998{
999 mUnusableUriHandlers << handler;
1000 return true;
1001}
1002
1003bool QgsProviderRegistry::handleUnusableUri( const QString &uri, UnusableUriDetails &details ) const
1004{
1005 for ( const QgsProviderRegistry::UnusableUriHandlerInterface *handler : mUnusableUriHandlers )
1006 {
1007 if ( handler->matchesUri( uri ) )
1008 {
1009 details = handler->details( uri );
1010 return true;
1011 }
1012 }
1013 return false;
1014}
1015
1016bool QgsProviderRegistry::shouldDeferUriForOtherProviders( const QString &uri, const QString &providerKey ) const
1017{
1018 const QList< ProviderCandidateDetails > providers = preferredProvidersForUri( uri );
1019 if ( providers.empty() )
1020 return false;
1021
1022 for ( const ProviderCandidateDetails &provider : providers )
1023 {
1024 if ( provider.metadata()->key() == providerKey )
1025 return false;
1026 }
1027 return true;
1028}
1029
1030bool QgsProviderRegistry::uriIsBlocklisted( const QString &uri ) const
1031{
1032 for ( auto it = mProviders.begin(); it != mProviders.end(); ++it )
1033 {
1034 if ( it->second->uriIsBlocklisted( uri ) )
1035 return true;
1036 }
1037 return false;
1038}
1039
1040QList<QgsProviderSublayerDetails> QgsProviderRegistry::querySublayers( const QString &uri, Qgis::SublayerQueryFlags flags, QgsFeedback *feedback ) const
1041{
1042 // never query sublayers for blocklisted uris
1043 if ( uriIsBlocklisted( uri ) )
1044 return {};
1045
1046 QList<QgsProviderSublayerDetails> res;
1047 for ( auto it = mProviders.begin(); it != mProviders.end(); ++it )
1048 {
1049 // if we should defer this uri for other providers, do so
1050 if ( shouldDeferUriForOtherProviders( uri, it->first ) )
1051 continue;
1052
1053 res.append( it->second->querySublayers( uri, flags, feedback ) );
1054 if ( feedback && feedback->isCanceled() )
1055 break;
1056 }
1057 return res;
1058}
@ VectorTile
Vector tile layers (since QGIS 3.32)
VectorExportResult
Vector layer export result codes.
Definition: qgis.h:652
DataType
Raster data types.
Definition: qgis.h:241
LayerType
Types of layers that can be added to a map.
Definition: qgis.h:114
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition: qgis.h:154
This class represents a coordinate reference system (CRS).
This is the interface for those who want to add custom data items to the browser tree.
Abstract base class for spatial data provider implementations.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
bool isCanceled() const SIP_HOLDGIL
Tells whether the operation has been canceled already.
Definition: qgsfeedback.h:54
Container of fields for a vector layer.
Definition: qgsfields.h:45
static QString wildcardsFromFilter(const QString &filter)
Given a filter string like "GeoTIFF Files (*.tiff *.tif)", extracts the wildcard portion of this filt...
A structured metadata store for a map layer.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Custom exception class which is raised when an operation is not supported.
Definition: qgsexception.h:119
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:484
void removeAllMapLayers()
Removes all registered layers.
Holds data provider key, description, and associated shared library file or function pointer informat...
virtual QgsRasterDataProvider * createRasterDataProvider(const QString &uri, const QString &format, int nBands, Qgis::DataType type, int width, int height, double *geoTransform, const QgsCoordinateReferenceSystem &crs, const QStringList &createOptions=QStringList())
Creates a new instance of the raster data provider.
virtual bool deleteStyleById(const QString &uri, const QString &styleId, QString &errCause)
Deletes a layer style defined by styleId.
virtual bool saveStyle(const QString &uri, const QString &qmlStyle, const QString &sldStyle, const QString &styleName, const QString &styleDescription, const QString &uiFileContent, bool useAsDefault, QString &errCause)
Saves a layer style to provider.
virtual QgsDataProvider * createProvider(const QString &uri, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags=QgsDataProvider::ReadFlags())
Class factory to return a pointer to a newly created QgsDataProvider object.
virtual bool saveLayerMetadata(const QString &uri, const QgsLayerMetadata &metadata, QString &errorMessage) SIP_THROW(QgsNotSupportedException)
Saves metadata to the layer corresponding to the specified uri.
virtual QString encodeUri(const QVariantMap &parts) const
Reassembles a provider data source URI from its component paths (e.g.
virtual QString absoluteToRelativeUri(const QString &uri, const QgsReadWriteContext &context) const
Converts absolute path(s) to relative path(s) in the given provider-specific URI.
virtual Qgis::VectorExportResult createEmptyLayer(const QString &uri, const QgsFields &fields, Qgis::WkbType wkbType, const QgsCoordinateReferenceSystem &srs, bool overwrite, QMap< int, int > &oldToNewAttrIdxMap, QString &errorMessage, const QMap< QString, QVariant > *options)
Creates new empty vector layer.
virtual bool styleExists(const QString &uri, const QString &styleId, QString &errorCause)
Returns true if a layer style with the specified styleId exists in the provider defined by uri.
virtual QString filters(Qgis::FileFilterType type)
Builds the list of file filter strings (supported formats)
QString key() const
This returns the unique key associated with the provider.
virtual QgsTransaction * createTransaction(const QString &connString)
Returns new instance of transaction.
virtual void initProvider()
Initialize the provider.
virtual QString getStyleById(const QString &uri, const QString &styleId, QString &errCause)
Gets a layer style defined by uri.
virtual QString loadStoredStyle(const QString &uri, QString &styleName, QString &errCause)
Loads a layer style from the provider storage, reporting its name.
@ PriorityForUri
Indicates that the metadata can calculate a priority for a URI.
virtual QString relativeToAbsoluteUri(const QString &uri, const QgsReadWriteContext &context) const
Converts relative path(s) to absolute path(s) in the given provider-specific URI.
virtual QString loadStyle(const QString &uri, QString &errCause)
Loads a layer style defined by uri.
virtual int listStyles(const QString &uri, QStringList &ids, QStringList &names, QStringList &descriptions, QString &errCause)
Lists stored layer styles in the provider defined by uri.
virtual QList< QPair< QString, QString > > pyramidResamplingMethods()
Returns pyramid resampling methods available for provider.
virtual QList< QgsDataItemProvider * > dataItemProviders() const
Returns data item providers.
virtual QVariantMap decodeUri(const QString &uri) const
Breaks a provider data source URI into its component paths (e.g.
Q_DECL_DEPRECATED QString library() const
This returns the library file name.
virtual bool createDb(const QString &dbPath, QString &errCause)
Creates database by the provider on the path.
Contains information pertaining to a candidate provider.
Contains information about unusable URIs which aren't handled by any registered providers.
QString detailedWarning
Contains a longer, user-friendly, translated message advising why the URI is not usable.
An interface used to handle unusable URIs which aren't handled by any registered providers,...
virtual UnusableUriDetails details(const QString &uri) const =0
Returns the details for advising the user why the uri is not usable.
virtual bool matchesUri(const QString &uri) const =0
Returns true if the handle is an unusable URI handler for the specified uri.
A registry / canonical manager of data providers.
QString absoluteToRelativeUri(const QString &providerKey, const QString &uri, const QgsReadWriteContext &context) const
Converts absolute path(s) to relative path(s) in the given provider-specific URI.
QgsDataProvider * createProvider(const QString &providerKey, const QString &dataSource, const QgsDataProvider::ProviderOptions &options=QgsDataProvider::ProviderOptions(), QgsDataProvider::ReadFlags flags=QgsDataProvider::ReadFlags())
Creates a new instance of a provider.
std::map< QString, QgsProviderMetadata * > Providers
Type for data provider metadata associative container.
bool styleExists(const QString &providerKey, const QString &uri, const QString &styleId, QString &errorCause)
Returns true if a layer style with the specified styleId exists in the provider defined by providerKe...
QString loadStyle(const QString &providerKey, const QString &uri, QString &errCause)
Loads a layer style defined by uri.
QString getStyleById(const QString &providerKey, const QString &uri, const QString &styleId, QString &errCause)
Gets a layer style defined by styleId.
QVariantMap decodeUri(const QString &providerKey, const QString &uri)
Breaks a provider data source URI into its component paths (e.g.
void setLibraryDirectory(const QDir &path)
Sets library directory where to search for plugins.
QString fileVectorTileFilters() const
Returns a file filter string for supported vector tile files.
QgsTransaction * createTransaction(const QString &providerKey, const QString &connString)
Returns new instance of transaction.
QList< QgsProviderSublayerDetails > querySublayers(const QString &uri, Qgis::SublayerQueryFlags flags=Qgis::SublayerQueryFlags(), QgsFeedback *feedback=nullptr) const
Queries the specified uri and returns a list of any valid sublayers found in the dataset which can be...
Q_DECL_DEPRECATED void registerGuis(QWidget *widget)
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
WidgetMode
Different ways a source select dialog can be used.
QString protocolDrivers() const
Returns a string containing the available protocol drivers.
QList< QgsProviderRegistry::ProviderCandidateDetails > preferredProvidersForUri(const QString &uri) const
Returns the details for the preferred provider(s) for opening the specified uri.
Q_DECL_DEPRECATED QString library(const QString &providerKey) const
Returns path for the library of the provider.
QString databaseDrivers() const
Returns a string containing the available database drivers.
QString encodeUri(const QString &providerKey, const QVariantMap &parts)
Reassembles a provider data source URI from its component paths (e.g.
QList< QgsDataItemProvider * > dataItemProviders(const QString &providerKey) const
Returns list of data item providers of the provider.
QgsRasterDataProvider * createRasterDataProvider(const QString &providerKey, const QString &uri, const QString &format, int nBands, Qgis::DataType type, int width, int height, double *geoTransform, const QgsCoordinateReferenceSystem &crs, const QStringList &createOptions=QStringList())
Creates new instance of raster data provider.
QList< QPair< QString, QString > > pyramidResamplingMethods(const QString &providerKey)
Returns list of raster pyramid resampling methods.
bool uriIsBlocklisted(const QString &uri) const
Returns true if the specified uri is known by any registered provider to be something which should be...
Q_DECL_DEPRECATED QLibrary * createProviderLibrary(const QString &providerKey) const
Returns a new QLibrary for the specified providerKey.
Qgis::VectorExportResult createEmptyLayer(const QString &providerKey, const QString &uri, const QgsFields &fields, Qgis::WkbType wkbType, const QgsCoordinateReferenceSystem &srs, bool overwrite, QMap< int, int > &oldToNewAttrIdxMap, QString &errorMessage, const QMap< QString, QVariant > *options)
Creates new empty vector layer.
bool handleUnusableUri(const QString &uri, UnusableUriDetails &details) const
Returns true if the specified uri can potentially be handled by QGIS, if additional dependencies or b...
QString fileVectorFilters() const
Returns a file filter string for supported vector files.
QString fileRasterFilters() const
Returns a file filter string for supported raster files.
QString fileMeshFilters() const
Returns a file filter string for supported mesh files.
QString pluginList(bool asHtml=false) const
Returns list of provider plugins found.
Q_DECL_DEPRECATED int providerCapabilities(const QString &providerKey) const
Returns the provider capabilities.
bool shouldDeferUriForOtherProviders(const QString &uri, const QString &providerKey) const
Returns true if the provider with matching providerKey should defer handling of the specified uri to ...
bool deleteStyleById(const QString &providerKey, const QString &uri, const QString &styleId, QString &errCause)
Deletes a layer style defined by styleId.
QStringList providerList() const
Returns list of available providers by their keys.
QString fileMeshDatasetFilters() const
Returns a file filter string for supported mesh dataset files.
QString loadStoredStyle(const QString &providerKey, const QString &uri, QString &styleName, QString &errCause)
Loads a layer style from the provider storage, reporting its name.
QDir libraryDirectory() const
Returns the library directory where plugins are found.
QString relativeToAbsoluteUri(const QString &providerKey, const QString &uri, const QgsReadWriteContext &context) const
Converts relative path(s) to absolute path(s) in the given provider-specific URI.
QgsProviderMetadata * providerMetadata(const QString &providerKey) const
Returns metadata of the provider or nullptr if not found.
int listStyles(const QString &providerKey, const QString &uri, QStringList &ids, QStringList &names, QStringList &descriptions, QString &errCause)
Lists stored layer styles in the provider defined by providerKey and uri.
bool createDb(const QString &providerKey, const QString &dbPath, QString &errCause)
Creates database by the provider on the path.
bool saveStyle(const QString &providerKey, const QString &uri, const QString &qmlStyle, const QString &sldStyle, const QString &styleName, const QString &styleDescription, const QString &uiFileContent, bool useAsDefault, QString &errCause)
Saves a layer style to provider.
QSet< QString > providersForLayerType(Qgis::LayerType type) const
Returns a list of the provider keys for available providers which handle the specified layer type.
bool registerProvider(QgsProviderMetadata *providerMetadata)
register a new vector data provider from its providerMetadata
Q_DECL_DEPRECATED QFunctionPointer function(const QString &providerKey, const QString &functionName) const
Gets pointer to provider function.
QString directoryDrivers() const
Returns a string containing the available directory drivers.
bool saveLayerMetadata(const QString &providerKey, const QString &uri, const QgsLayerMetadata &metadata, QString &errorMessage) SIP_THROW(QgsNotSupportedException)
Saves metadata to the layer corresponding to the specified uri.
bool registerUnusableUriHandler(UnusableUriHandlerInterface *handler)
Registers an unusable URI handler, used to handle unusable URIs which aren't handled by any registere...
Q_DECL_DEPRECATED QWidget * createSelectionWidget(const QString &providerKey, QWidget *parent=nullptr, Qt::WindowFlags fl=Qt::WindowFlags(), QgsProviderRegistry::WidgetMode widgetMode=QgsProviderRegistry::WidgetMode::None)
Returns a new widget for selecting layers from a provider.
QString filePointCloudFilters() const
Returns a file filter string for supported point clouds.
Base class for raster data providers.
The class is used as a container of context for various read/write operations on other objects.
Scoped object for logging of the runtime for a single operation or group of operations.
This class allows including a set of layers in a database-side transaction, provided the layer data p...
#define Q_NOWARN_DEPRECATED_POP
Definition: qgis.h:4572
#define Q_NOWARN_DEPRECATED_PUSH
Definition: qgis.h:4571
#define cast_to_fptr(f)
Definition: qgis.h:3860
#define QgsDebugMsgLevel(str, level)
Definition: qgslogger.h:39
#define QgsDebugError(str)
Definition: qgslogger.h:38
void cleanupProviderFunction_t()
const QgsCoordinateReferenceSystem & crs
Setting options for creating vector data providers.