QGIS API Documentation  3.6.0-Noosa (5873452)
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 <QString>
22 #include <QDir>
23 #include <QLibrary>
24 
25 #include "qgis.h"
26 #include "qgsdataprovider.h"
27 #include "qgslogger.h"
28 #include "qgsmessageoutput.h"
29 #include "qgsmessagelog.h"
30 #include "qgsprovidermetadata.h"
31 #include "qgsvectorlayer.h"
32 #include "qgsproject.h"
35 
36 // typedefs for provider plugin functions of interest
37 typedef QString providerkey_t();
38 typedef QString description_t();
39 typedef bool isprovider_t();
40 typedef QString fileVectorFilters_t();
41 typedef void fileMeshFilters_t( QString &fileMeshFiltersString, QString &fileMeshDatasetFiltersString );
42 typedef void buildsupportedrasterfilefilter_t( QString &fileFiltersString );
43 typedef QString databaseDrivers_t();
44 typedef QString directoryDrivers_t();
45 typedef QString protocolDrivers_t();
46 typedef void initProviderFunction_t();
47 typedef QVariantMap decodeUri_t( const QString &uri );
48 
49 //typedef int dataCapabilities_t();
50 //typedef QgsDataItem * dataItem_t(QString);
51 
52 static QgsProviderRegistry *sInstance = nullptr;
53 
55 {
56  if ( !sInstance )
57  {
58  static QMutex sMutex;
59  QMutexLocker locker( &sMutex );
60  if ( !sInstance )
61  {
62  sInstance = new QgsProviderRegistry( pluginPath );
63  }
64  }
65  return sInstance;
66 } // QgsProviderRegistry::instance
67 
68 
69 
70 QgsProviderRegistry::QgsProviderRegistry( const QString &pluginPath )
71 {
72  // At startup, examine the libs in the qgis/lib dir and store those that
73  // are a provider shared lib
74  // check all libs in the current plugin directory and get name and descriptions
75  //TODO figure out how to register and identify data source plugin for a specific
76  //TODO layer type
77 #if 0
78  char **argv = qApp->argv();
79  QString appDir = argv[0];
80  int bin = appDir.findRev( "/bin", -1, false );
81  QString baseDir = appDir.left( bin );
82  QString mLibraryDirectory = baseDir + "/lib";
83 #endif
84  mLibraryDirectory = pluginPath;
85  init();
86 }
87 
88 
89 void QgsProviderRegistry::init()
90 {
91  // add standard providers
92  mProviders[ QgsMemoryProvider::providerKey() ] = new QgsProviderMetadata( QgsMemoryProvider::providerKey(), QgsMemoryProvider::providerDescription(), &QgsMemoryProvider::createProvider );
93  mProviders[ QgsMeshMemoryDataProvider::providerKey() ] = new QgsProviderMetadata( QgsMeshMemoryDataProvider::providerKey(), QgsMeshMemoryDataProvider::providerDescription(), &QgsMeshMemoryDataProvider::createProvider );
94 
95  mLibraryDirectory.setSorting( QDir::Name | QDir::IgnoreCase );
96  mLibraryDirectory.setFilter( QDir::Files | QDir::NoSymLinks );
97 
98 #if defined(Q_OS_WIN) || defined(__CYGWIN__)
99  mLibraryDirectory.setNameFilters( QStringList( "*.dll" ) );
100 #elif defined(ANDROID)
101  mLibraryDirectory.setNameFilters( QStringList( "*provider.so" ) );
102 #else
103  mLibraryDirectory.setNameFilters( QStringList( QStringLiteral( "*.so" ) ) );
104 #endif
105 
106  QgsDebugMsg( QStringLiteral( "Checking %1 for provider plugins" ).arg( mLibraryDirectory.path() ) );
107 
108  if ( mLibraryDirectory.count() == 0 )
109  {
110  QString msg = QObject::tr( "No QGIS data provider plugins found in:\n%1\n" ).arg( mLibraryDirectory.path() );
111  msg += QObject::tr( "No vector layers can be loaded. Check your QGIS installation" );
112 
114  output->setTitle( QObject::tr( "No Data Providers" ) );
116  output->showMessage();
117  return;
118  }
119 
120  // provider file regex pattern, only files matching the pattern are loaded if the variable is defined
121  QString filePattern = getenv( "QGIS_PROVIDER_FILE" );
122  QRegExp fileRegexp;
123  if ( !filePattern.isEmpty() )
124  {
125  fileRegexp.setPattern( filePattern );
126  }
127 
128  Q_FOREACH ( const QFileInfo &fi, mLibraryDirectory.entryInfoList() )
129  {
130  if ( !fileRegexp.isEmpty() )
131  {
132  if ( fileRegexp.indexIn( fi.fileName() ) == -1 )
133  {
134  QgsDebugMsg( "provider " + fi.fileName() + " skipped because doesn't match pattern " + filePattern );
135  continue;
136  }
137  }
138 
139  QLibrary myLib( fi.filePath() );
140  if ( !myLib.load() )
141  {
142  QgsDebugMsg( QStringLiteral( "Checking %1: ...invalid (lib not loadable): %2" ).arg( myLib.fileName(), myLib.errorString() ) );
143  continue;
144  }
145 
146  //MH: Added a further test to detect non-provider plugins linked to provider plugins.
147  //Only pure provider plugins have 'type' not defined
148  isprovider_t *hasType = reinterpret_cast< isprovider_t * >( cast_to_fptr( myLib.resolve( "type" ) ) );
149  if ( hasType )
150  {
151  QgsDebugMsg( QStringLiteral( "Checking %1: ...invalid (has type method)" ).arg( myLib.fileName() ) );
152  continue;
153  }
154 
155  // get the description and the key for the provider plugin
156  isprovider_t *isProvider = reinterpret_cast< isprovider_t * >( cast_to_fptr( myLib.resolve( "isProvider" ) ) );
157  if ( !isProvider )
158  {
159  QgsDebugMsg( QStringLiteral( "Checking %1: ...invalid (no isProvider method)" ).arg( myLib.fileName() ) );
160  continue;
161  }
162 
163  // check to see if this is a provider plugin
164  if ( !isProvider() )
165  {
166  QgsDebugMsg( QStringLiteral( "Checking %1: ...invalid (not a provider)" ).arg( myLib.fileName() ) );
167  continue;
168  }
169 
170  // looks like a provider. get the key and description
171  description_t *pDesc = reinterpret_cast< description_t * >( cast_to_fptr( myLib.resolve( "description" ) ) );
172  if ( !pDesc )
173  {
174  QgsDebugMsg( QStringLiteral( "Checking %1: ...invalid (no description method)" ).arg( myLib.fileName() ) );
175  continue;
176  }
177 
178  providerkey_t *pKey = reinterpret_cast< providerkey_t * >( cast_to_fptr( myLib.resolve( "providerKey" ) ) );
179  if ( !pKey )
180  {
181  QgsDebugMsg( QStringLiteral( "Checking %1: ...invalid (no providerKey method)" ).arg( myLib.fileName() ) );
182  continue;
183  }
184 
185  // add this provider to the provider map
186  mProviders[pKey()] = new QgsProviderMetadata( pKey(), pDesc(), myLib.fileName() );
187 
188  // load database drivers
189  databaseDrivers_t *pDatabaseDrivers = reinterpret_cast< databaseDrivers_t * >( cast_to_fptr( myLib.resolve( "databaseDrivers" ) ) );
190  if ( pDatabaseDrivers )
191  {
192  mDatabaseDrivers = pDatabaseDrivers();
193  }
194 
195  // load directory drivers
196  directoryDrivers_t *pDirectoryDrivers = reinterpret_cast< directoryDrivers_t * >( cast_to_fptr( myLib.resolve( "directoryDrivers" ) ) );
197  if ( pDirectoryDrivers )
198  {
199  mDirectoryDrivers = pDirectoryDrivers();
200  }
201 
202  // load protocol drivers
203  protocolDrivers_t *pProtocolDrivers = reinterpret_cast< protocolDrivers_t * >( cast_to_fptr( myLib.resolve( "protocolDrivers" ) ) );
204  if ( pProtocolDrivers )
205  {
206  mProtocolDrivers = pProtocolDrivers();
207  }
208 
209  // now get vector file filters, if any
210  fileVectorFilters_t *pFileVectorFilters = reinterpret_cast< fileVectorFilters_t * >( cast_to_fptr( myLib.resolve( "fileVectorFilters" ) ) );
211  if ( pFileVectorFilters )
212  {
213  QString fileVectorFilters = pFileVectorFilters();
214 
215  if ( !fileVectorFilters.isEmpty() )
216  mVectorFileFilters += fileVectorFilters;
217 
218  QgsDebugMsg( QStringLiteral( "Checking %1: ...loaded OK (%2 file filters)" ).arg( myLib.fileName() ).arg( fileVectorFilters.split( ";;" ).count() ) );
219  }
220 
221  // now get raster file filters, if any
222  // this replaces deprecated QgsRasterLayer::buildSupportedRasterFileFilter
224  reinterpret_cast< buildsupportedrasterfilefilter_t * >( cast_to_fptr( myLib.resolve( "buildSupportedRasterFileFilter" ) ) );
225  if ( pBuild )
226  {
227  QString fileRasterFilters;
228  pBuild( fileRasterFilters );
229 
230  QgsDebugMsg( "raster filters: " + fileRasterFilters );
231  if ( !fileRasterFilters.isEmpty() )
232  mRasterFileFilters += fileRasterFilters;
233 
234  QgsDebugMsg( QStringLiteral( "Checking %1: ...loaded OK (%2 file filters)" ).arg( myLib.fileName() ).arg( fileRasterFilters.split( ";;" ).count() ) );
235  }
236 
237  // now get mesh file filters, if any
238  fileMeshFilters_t *pFileMeshFilters = reinterpret_cast< fileMeshFilters_t * >( cast_to_fptr( myLib.resolve( "fileMeshFilters" ) ) );
239  if ( pFileMeshFilters )
240  {
241  QString fileMeshFilters;
242  QString fileMeshDatasetFilters;
243 
244  pFileMeshFilters( fileMeshFilters, fileMeshDatasetFilters );
245 
246  if ( !fileMeshFilters.isEmpty() )
247  mMeshFileFilters += fileMeshFilters;
248  if ( !fileMeshDatasetFilters.isEmpty() )
249  mMeshDatasetFileFilters += fileMeshDatasetFilters;
250 
251  QgsDebugMsg( QStringLiteral( "Checking %1: ...loaded OK (%2 file mesh filters, %3 file dataset filters)" ).arg( myLib.fileName() ).arg( mMeshFileFilters.split( ";;" ).count() ).arg( mMeshDatasetFileFilters.split( ";;" ).count() ) );
252  }
253 
254  // call initProvider() if such function is available - allows provider to register its services to QGIS
255  initProviderFunction_t *initFunc = reinterpret_cast< initProviderFunction_t * >( cast_to_fptr( myLib.resolve( "initProvider" ) ) );
256  if ( initFunc )
257  initFunc();
258  }
259 } // QgsProviderRegistry ctor
260 
261 
262 // typedef for the unload dataprovider function
264 
265 void QgsProviderRegistry::clean()
266 {
268 
269  Providers::const_iterator it = mProviders.begin();
270 
271  while ( it != mProviders.end() )
272  {
273  QgsDebugMsgLevel( QStringLiteral( "cleanup:%1" ).arg( it->first ), 5 );
274  QString lib = it->second->library();
275  if ( !lib.isEmpty() )
276  {
277  QLibrary myLib( lib );
278  if ( myLib.isLoaded() )
279  {
280  cleanupProviderFunction_t *cleanupFunc = reinterpret_cast< cleanupProviderFunction_t * >( cast_to_fptr( myLib.resolve( "cleanupProvider" ) ) );
281  if ( cleanupFunc )
282  cleanupFunc();
283  }
284  }
285  delete it->second;
286  ++it;
287  }
288  mProviders.clear();
289 }
290 
292 {
293  clean();
294  if ( sInstance == this )
295  sInstance = nullptr;
296 }
297 
298 
307 static
308 QgsProviderMetadata *findMetadata_( QgsProviderRegistry::Providers const &metaData,
309  QString const &providerKey )
310 {
311  QgsProviderRegistry::Providers::const_iterator i =
312  metaData.find( providerKey );
313 
314  if ( i != metaData.end() )
315  {
316  return i->second;
317  }
318 
319  return nullptr;
320 } // findMetadata_
321 
322 
323 
324 QString QgsProviderRegistry::library( QString const &providerKey ) const
325 {
326  QgsProviderMetadata *md = findMetadata_( mProviders, providerKey );
327 
328  if ( md )
329  {
330  return md->library();
331  }
332 
333  return QString();
334 }
335 
336 
337 QString QgsProviderRegistry::pluginList( bool asHTML ) const
338 {
339  Providers::const_iterator it = mProviders.begin();
340 
341  if ( mProviders.empty() )
342  return QObject::tr( "No data provider plugins are available. No vector layers can be loaded" );
343 
344  QString list;
345 
346  if ( asHTML )
347  list += QLatin1String( "<ol>" );
348 
349  while ( it != mProviders.end() )
350  {
351  if ( asHTML )
352  list += QLatin1String( "<li>" );
353 
354  list += it->second->description();
355 
356  if ( asHTML )
357  list += QLatin1String( "<br></li>" );
358  else
359  list += '\n';
360 
361  ++it;
362  }
363 
364  if ( asHTML )
365  list += QLatin1String( "</ol>" );
366 
367  return list;
368 }
369 
371 {
372  mLibraryDirectory = path;
373  clean();
374  init();
375 }
376 
378 {
379  return mLibraryDirectory;
380 }
381 
382 
383 
384 // typedef for the QgsDataProvider class factory
385 typedef QgsDataProvider *classFactoryFunction_t( const QString *, const QgsDataProvider::ProviderOptions &options );
386 
387 
388 /* Copied from QgsVectorLayer::setDataProvider
389  * TODO: Make it work in the generic environment
390  *
391  * TODO: Is this class really the best place to put a data provider loader?
392  * It seems more sensible to provide the code in one place rather than
393  * in qgsrasterlayer, qgsvectorlayer, serversourceselect, etc.
394  */
395 QgsDataProvider *QgsProviderRegistry::createProvider( QString const &providerKey, QString const &dataSource, const QgsDataProvider::ProviderOptions &options )
396 {
397  // XXX should I check for and possibly delete any pre-existing providers?
398  // XXX How often will that scenario occur?
399 
400  const QgsProviderMetadata *metadata = providerMetadata( providerKey );
401  if ( !metadata )
402  {
403  QgsMessageLog::logMessage( QObject::tr( "Invalid data provider %1" ).arg( providerKey ) );
404  return nullptr;
405  }
406 
407  if ( metadata->createFunction() )
408  {
409  return metadata->createFunction()( dataSource, options );
410  }
411 
412  // load the plugin
413  QString lib = library( providerKey );
414 
415 #ifdef TESTPROVIDERLIB
416  const char *cLib = lib.toUtf8();
417 
418  // test code to help debug provider loading problems
419  // void *handle = dlopen(cLib, RTLD_LAZY);
420  void *handle = dlopen( cOgrLib, RTLD_LAZY | RTLD_GLOBAL );
421  if ( !handle )
422  {
423  QgsLogger::warning( "Error in dlopen" );
424  }
425  else
426  {
427  QgsDebugMsg( QStringLiteral( "dlopen succeeded" ) );
428  dlclose( handle );
429  }
430 
431 #endif
432  // load the data provider
433  QLibrary myLib( lib );
434 
435  QgsDebugMsg( "Library name is " + myLib.fileName() );
436  if ( !myLib.load() )
437  {
438  QgsMessageLog::logMessage( QObject::tr( "Failed to load %1: %2" ).arg( lib, myLib.errorString() ) );
439  return nullptr;
440  }
441 
442  classFactoryFunction_t *classFactory = reinterpret_cast< classFactoryFunction_t * >( cast_to_fptr( myLib.resolve( "classFactory" ) ) );
443  if ( !classFactory )
444  {
445  QgsDebugMsg( QStringLiteral( "Failed to load %1: no classFactory method" ).arg( lib ) );
446  return nullptr;
447  }
448 
449  QgsDataProvider *dataProvider = classFactory( &dataSource, options );
450  if ( !dataProvider )
451  {
452  QgsMessageLog::logMessage( QObject::tr( "Unable to instantiate the data provider plugin %1" ).arg( lib ) );
453  myLib.unload();
454  return nullptr;
455  }
456 
457  QgsDebugMsg( QStringLiteral( "Instantiated the data provider plugin: %1" ).arg( dataProvider->name() ) );
458  return dataProvider;
459 } // QgsProviderRegistry::setDataProvider
460 
461 QVariantMap QgsProviderRegistry::decodeUri( const QString &providerKey, const QString &uri )
462 {
463  std::unique_ptr< QLibrary > library( createProviderLibrary( providerKey ) );
464  if ( !library )
465  {
466  return QVariantMap();
467  }
468 
469  decodeUri_t *decodeUri = reinterpret_cast< decodeUri_t *>( cast_to_fptr( library->resolve( "decodeUri" ) ) );
470  if ( !decodeUri )
471  {
472  return QVariantMap();
473  }
474  return decodeUri( uri );
475 }
476 
477 int QgsProviderRegistry::providerCapabilities( const QString &providerKey ) const
478 {
479  std::unique_ptr< QLibrary > library( createProviderLibrary( providerKey ) );
480  if ( !library )
481  {
483  }
484 
485  dataCapabilities_t *dataCapabilities = reinterpret_cast< dataCapabilities_t *>( cast_to_fptr( library->resolve( "dataCapabilities" ) ) );
486  if ( !dataCapabilities )
487  {
489  }
490 
491  return dataCapabilities();
492 }
493 
494 // This should be QWidget, not QDialog
495 typedef QWidget *selectFactoryFunction_t( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode );
496 
497 QWidget *QgsProviderRegistry::createSelectionWidget( const QString &providerKey,
498  QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode )
499 {
500  selectFactoryFunction_t *selectFactory =
501  reinterpret_cast< selectFactoryFunction_t * >( cast_to_fptr( function( providerKey, "selectWidget" ) ) );
502 
503  if ( !selectFactory )
504  return nullptr;
505 
506  return selectFactory( parent, fl, widgetMode );
507 }
508 
509 QFunctionPointer QgsProviderRegistry::function( QString const &providerKey,
510  QString const &functionName )
511 {
512  QString lib = library( providerKey );
513  if ( lib.isEmpty() )
514  return nullptr;
515 
516  QLibrary myLib( library( providerKey ) );
517 
518  QgsDebugMsg( "Library name is " + myLib.fileName() );
519 
520  if ( myLib.load() )
521  {
522  return myLib.resolve( functionName.toLatin1().data() );
523  }
524  else
525  {
526  QgsDebugMsg( "Cannot load library: " + myLib.errorString() );
527  return nullptr;
528  }
529 }
530 
531 QLibrary *QgsProviderRegistry::createProviderLibrary( QString const &providerKey ) const
532 {
533  QString lib = library( providerKey );
534  if ( lib.isEmpty() )
535  return nullptr;
536 
537  std::unique_ptr< QLibrary > myLib( new QLibrary( lib ) );
538 
539  QgsDebugMsg( "Library name is " + myLib->fileName() );
540 
541  if ( myLib->load() )
542  return myLib.release();
543 
544  QgsDebugMsg( "Cannot load library: " + myLib->errorString() );
545 
546  return nullptr;
547 }
548 
549 void QgsProviderRegistry::registerGuis( QWidget *parent )
550 {
551  typedef void registerGui_function( QWidget * parent );
552 
553  Q_FOREACH ( const QString &provider, providerList() )
554  {
555  registerGui_function *registerGui = reinterpret_cast< registerGui_function * >( cast_to_fptr( function( provider, "registerGui" ) ) );
556 
557  if ( !registerGui )
558  continue;
559 
560  registerGui( parent );
561  }
562 }
563 
565 {
566  if ( providerMetadata )
567  {
568  if ( mProviders.find( providerMetadata->key() ) == mProviders.end() )
569  {
570  mProviders[ providerMetadata->key() ] = providerMetadata;
571  return true;
572  }
573  else
574  {
575  QgsDebugMsgLevel( QStringLiteral( "Cannot register provider metadata: a provider with the same key (%1) was already registered!" ).arg( providerMetadata->key() ), 2 );
576  }
577  }
578  else
579  {
580  QgsDebugMsgLevel( QStringLiteral( "Trying to register a null metadata provider!" ), 2 );
581  }
582  return false;
583 }
584 
586 {
587  return mVectorFileFilters;
588 }
589 
591 {
592  return mRasterFileFilters;
593 }
594 
596 {
597  return mMeshFileFilters;
598 }
599 
601 {
602  return mMeshDatasetFileFilters;
603 }
604 
606 {
607  return mDatabaseDrivers;
608 }
609 
611 {
612  return mDirectoryDrivers;
613 }
614 
616 {
617  return mProtocolDrivers;
618 }
619 
621 {
622  QStringList lst;
623  for ( Providers::const_iterator it = mProviders.begin(); it != mProviders.end(); ++it )
624  {
625  lst.append( it->first );
626  }
627  return lst;
628 }
629 
630 const QgsProviderMetadata *QgsProviderRegistry::providerMetadata( const QString &providerKey ) const
631 {
632  return findMetadata_( mProviders, providerKey );
633 }
bool registerProvider(QgsProviderMetadata *providerMetadata)
register a new vector data provider from its providerMetadata
WidgetMode
Different ways a source select dialog can be used (embedded is for the data source manager dialog) ...
QString databaseDrivers_t()
void cleanupProviderFunction_t()
QString key() const
This returns the unique key associated with the provider.
virtual void setTitle(const QString &title)=0
Sets title for the messages.
QVariantMap decodeUri_t(const QString &uri)
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
QString library() const
This returns the library file name.
static void warning(const QString &msg)
Goes to qWarning.
Definition: qgslogger.cpp:121
virtual QString protocolDrivers() const
Returns a string containing the available protocol drivers.
QString library(const QString &providerKey) const
Returns path for the library of the provider.
void registerGuis(QWidget *widget)
void fileMeshFilters_t(QString &fileMeshFiltersString, QString &fileMeshDatasetFiltersString)
virtual QString databaseDrivers() const
Returns a string containing the available database drivers.
QString directoryDrivers_t()
static QgsMessageOutput * createMessageOutput()
function that returns new class derived from QgsMessageOutput (don&#39;t forget to delete it then if show...
QgsDataProvider * classFactoryFunction_t(const QString *, const QgsDataProvider::ProviderOptions &options)
QVariantMap decodeUri(const QString &providerKey, const QString &uri)
Breaks a provider data source URI into its component paths (e.g.
Abstract base class for spatial data provider implementations.
virtual QString name() const =0
Returns a provider name.
QString description_t()
virtual QString fileVectorFilters() const
Returns vector file filter string.
QgsDataProvider * createProvider(const QString &providerKey, const QString &dataSource, const QgsDataProvider::ProviderOptions &options=QgsDataProvider::ProviderOptions())
Creates a new instance of a provider.
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.
bool isprovider_t()
void initProviderFunction_t()
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
#define QgsDebugMsgLevel(str, level)
Definition: qgslogger.h:39
QLibrary * createProviderLibrary(const QString &providerKey) const
Returns a new QLibrary for the specified providerKey.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
virtual void setMessage(const QString &message, MessageType msgType)=0
Sets message, it won&#39;t be displayed until.
void setLibraryDirectory(const QDir &path)
Sets library directory where to search for plugins.
CreateDataProviderFunction createFunction() const
Returns a pointer to the direct provider creation function, if supported by the provider.
const QgsProviderMetadata * providerMetadata(const QString &providerKey) const
Returns metadata of the provider or NULL if not found.
QString pluginList(bool asHtml=false) const
Returns list of provider plugins found.
void removeAllMapLayers()
Removes all registered layers.
#define cast_to_fptr(f)
Definition: qgis.h:158
virtual QString fileMeshDatasetFilters() const
Returns mesh&#39;s dataset file filter string.
QString fileVectorFilters_t()
A registry / canonical manager of data providers.
int providerCapabilities(const QString &providerKey) const
Returns the provider capabilities.
virtual void showMessage(bool blocking=true)=0
display the message to the user and deletes itself
Setting options for creating vector data providers.
virtual QString fileMeshFilters() const
Returns mesh file filter string.
QString providerkey_t()
Holds data provider key, description, and associated shared library file or function pointer informat...
virtual QString directoryDrivers() const
Returns a string containing the available directory drivers.
std::map< QString, QgsProviderMetadata * > Providers
Open the given vector data source.
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:430
QWidget * selectFactoryFunction_t(QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode)
QFunctionPointer function(const QString &providerKey, const QString &functionName)
Gets pointer to provider function.
virtual QString fileRasterFilters() const
Returns raster file filter string.
void buildsupportedrasterfilefilter_t(QString &fileFiltersString)
QString protocolDrivers_t()
QStringList providerList() const
Returns list of available providers by their keys.
Interface for showing messages from QGIS in GUI independent way.
int dataCapabilities_t()
QDir libraryDirectory() const
Returns the library directory where plugins are found.