QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgslayertreeembeddedwidgetregistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayertreeembeddedwidgetregistry.h
3  --------------------------------------
4  Date : May 2016
5  Copyright : (C) 2016 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 #ifndef QGSLAYERTREEEMBEDDEDWIDGETREGISTRY_H
17 #define QGSLAYERTREEEMBEDDEDWIDGETREGISTRY_H
18 
19 #include <QMap>
20 #include "qgis.h"
21 #include <QWidget>
22 #include "qgis_gui.h"
23 
24 
25 class QgsMapLayer;
26 
36 {
37  public:
39 
41  virtual QString id() const = 0;
42 
44  virtual QString name() const = 0;
45 
51  virtual QWidget *createWidget( QgsMapLayer *layer, int widgetIndex ) = 0 SIP_FACTORY;
52 
54  virtual bool supportsLayer( QgsMapLayer *layer ) = 0;
55 };
56 
71 {
72  public:
73 
81 
83 
88 
90  QStringList providers() const;
91 
93  QgsLayerTreeEmbeddedWidgetProvider *provider( const QString &providerId ) const;
94 
99  bool addProvider( QgsLayerTreeEmbeddedWidgetProvider *provider SIP_TRANSFER );
100 
105  bool removeProvider( const QString &providerId );
106 
107  protected:
108 
110  QMap<QString, QgsLayerTreeEmbeddedWidgetProvider *> mProviders;
111 
112  private:
113 #ifdef SIP_RUN
115 #endif
116 
117 };
118 
119 
120 #endif // QGSLAYERTREEEMBEDDEDWIDGETREGISTRY_H
QgsLayerTreeEmbeddedWidgetProvider::supportsLayer
virtual bool supportsLayer(QgsMapLayer *layer)=0
Whether it makes sense to use this widget for a particular layer.
qgis.h
QgsLayerTreeEmbeddedWidgetProvider::createWidget
virtual QWidget * createWidget(QgsMapLayer *layer, int widgetIndex)=0
Factory to create widgets.
QgsLayerTreeEmbeddedWidgetProvider::name
virtual QString name() const =0
Human readable name - may be translatable with tr()
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsLayerTreeEmbeddedWidgetProvider
Provider interface to be implemented in order to introduce new kinds of embedded widgets for use in l...
Definition: qgslayertreeembeddedwidgetregistry.h:36
QgsLayerTreeEmbeddedWidgetRegistry::operator=
QgsLayerTreeEmbeddedWidgetRegistry & operator=(const QgsLayerTreeEmbeddedWidgetRegistry &other)=delete
QgsLayerTreeEmbeddedWidgetRegistry cannot be copied.
QgsLayerTreeEmbeddedWidgetRegistry
Registry of widgets that may be embedded into layer tree view.
Definition: qgslayertreeembeddedwidgetregistry.h:71
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsLayerTreeEmbeddedWidgetProvider::id
virtual QString id() const =0
Unique name of the provider (among other providers)
QgsLayerTreeEmbeddedWidgetRegistry::QgsLayerTreeEmbeddedWidgetRegistry
QgsLayerTreeEmbeddedWidgetRegistry(const QgsLayerTreeEmbeddedWidgetRegistry &other)=delete
QgsLayerTreeEmbeddedWidgetRegistry cannot be copied.
QgsMapLayer
Base class for all map layer types.
Definition: qgsmaplayer.h:83
QgsLayerTreeEmbeddedWidgetRegistry::mProviders
QMap< QString, QgsLayerTreeEmbeddedWidgetProvider * > mProviders
storage of all the providers
Definition: qgslayertreeembeddedwidgetregistry.h:110
QgsLayerTreeEmbeddedWidgetProvider::~QgsLayerTreeEmbeddedWidgetProvider
virtual ~QgsLayerTreeEmbeddedWidgetProvider()=default