QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsvectortileproviderguimetadata.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectortileproviderguimetadata.cpp
3  --------------------------------------
4  Date : March 2020
5  Copyright : (C) 2020 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgsapplication.h"
21 
23 
24 class QgsVectorTileSourceSelectProvider : public QgsSourceSelectProvider
25 {
26  public:
27 
28  QString providerKey() const override { return QStringLiteral( "vectortile" ); }
29  QString text() const override { return QObject::tr( "Vector Tile" ); }
30  int ordering() const override { return QgsSourceSelectProvider::OrderRemoteProvider + 50; }
31  QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddVectorTileLayer.svg" ) ); }
32  QgsAbstractDataSourceWidget *createDataSourceWidget( QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Widget, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Embedded ) const override
33  {
34  return new QgsVectorTileSourceSelect( parent, fl, widgetMode );
35  }
36 };
37 
38 QgsVectorTileProviderGuiMetadata::QgsVectorTileProviderGuiMetadata()
39  : QgsProviderGuiMetadata( QStringLiteral( "vectortile" ) )
40 {
41 }
42 
43 QList<QgsDataItemGuiProvider *> QgsVectorTileProviderGuiMetadata::dataItemGuiProviders()
44 {
45  return QList<QgsDataItemGuiProvider *>()
46  << new QgsVectorTileDataItemGuiProvider;
47 }
48 
49 QList<QgsSourceSelectProvider *> QgsVectorTileProviderGuiMetadata::sourceSelectProviders()
50 {
51  QList<QgsSourceSelectProvider *> providers;
52  providers << new QgsVectorTileSourceSelectProvider;
53  return providers;
54 }
55 
qgsvectortilesourceselect.h
QgsSourceSelectProvider::ordering
virtual int ordering() const
Ordering: the source select provider registry will be able to sort the source selects (ascending) usi...
Definition: qgssourceselectprovider.h:80
qgssourceselectprovider.h
QgsAbstractDataSourceWidget
Abstract base Data Source Widget to create connections and add layers This class provides common func...
Definition: qgsabstractdatasourcewidget.h:43
qgsvectortiledataitemguiprovider.h
QgsSourceSelectProvider
This is the interface for those who want to add entries to the QgsDataSourceManagerDialog.
Definition: qgssourceselectprovider.h:35
QgsProviderGuiMetadata
Holds data for GUI part of the data providers.
Definition: qgsproviderguimetadata.h:40
qgsvectortileproviderguimetadata.h
qgsapplication.h
QgsSourceSelectProvider::createDataSourceWidget
virtual QgsAbstractDataSourceWidget * createDataSourceWidget(QWidget *parent=nullptr, Qt::WindowFlags fl=Qt::Widget, QgsProviderRegistry::WidgetMode widgetMode=QgsProviderRegistry::WidgetMode::Embedded) const =0
Create a new instance of QgsAbstractDataSourceWidget (or nullptr).
QgsProviderRegistry::WidgetMode
WidgetMode
Different ways a source select dialog can be used.
Definition: qgsproviderregistry.h:70
QgsSourceSelectProvider::text
virtual QString text() const =0
Text for the menu item entry, it will be visible to the user so make sure it's translatable.
QgsSourceSelectProvider::icon
virtual QIcon icon() const =0
Creates a new instance of an QIcon for the menu item entry.
QgsSourceSelectProvider::providerKey
virtual QString providerKey() const =0
Data Provider key.
QgsSourceSelectProvider::OrderRemoteProvider
@ OrderRemoteProvider
Starting point for remote (online) providers (e.g. WMS)
Definition: qgssourceselectprovider.h:44
QgsApplication::getThemeIcon
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Definition: qgsapplication.cpp:693