Skip to content
Permalink
Browse files
Add sourceSelectProviders() to the ogr data provider
This is the first data provider real implementation,
all other data provider will follow.
  • Loading branch information
elpaso committed Sep 4, 2017
1 parent 90f8730 commit 42bd913
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
@@ -50,4 +50,5 @@ class QgsOgrDataCollectionItem : public QgsDataCollectionItem
};



#endif // QGSOGRDATAITEMS_H
@@ -35,6 +35,8 @@ email : sherman at mrcc.com
#include "qgsogrdataitems.h"
#include "qgsgeopackagedataitems.h"
#include "qgswkbtypes.h"
#include "qgssourceselectprovider.h"
#include "qgsogrsourceselect.h"
#include "qgis.h"


@@ -4346,3 +4348,29 @@ QGISEXTERN bool deleteLayer( const QString &uri, QString &errCause )
errCause = QObject::tr( "Layer not found: %1" ).arg( uri );
return false;
}


//! Provider for OGR vector source select
class QgsOgrVectorSourceSelectProvider : public QgsSourceSelectProvider
{
public:

virtual QString providerKey() const override { return QStringLiteral( "ogr" ); }
virtual QString text() const override { return QObject::tr( "Vector" ); }
virtual QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddOgrLayer.svg" ) ); }
virtual QgsAbstractDataSourceWidget *createDataSourceWidget( QWidget *parent = nullptr ) const override
{
return new QgsOgrSourceSelect( parent );
}
};


QGISEXTERN QList<QgsSourceSelectProvider *> *sourceSelectProviders()
{
QList<QgsSourceSelectProvider *> *providers = new QList<QgsSourceSelectProvider *>();

*providers
<< new QgsOgrVectorSourceSelectProvider;

return providers;
}

0 comments on commit 42bd913

Please sign in to comment.