QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
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
25class QgsMapLayer;
26
35{
36 public:
38
40 virtual QString id() const = 0;
41
43 virtual QString name() const = 0;
44
50 virtual QWidget *createWidget( QgsMapLayer *layer, int widgetIndex ) = 0 SIP_FACTORY;
51
53 virtual bool supportsLayer( QgsMapLayer *layer ) = 0;
54};
55
69{
70 public:
71
79
81
84
86 QStringList providers() const;
87
89 QgsLayerTreeEmbeddedWidgetProvider *provider( const QString &providerId ) const;
90
95 bool addProvider( QgsLayerTreeEmbeddedWidgetProvider *provider SIP_TRANSFER );
96
101 bool removeProvider( const QString &providerId );
102
103 protected:
104
106 QMap<QString, QgsLayerTreeEmbeddedWidgetProvider *> mProviders;
107
108 private:
109#ifdef SIP_RUN
111#endif
112
113};
114
115
116#endif // QGSLAYERTREEEMBEDDEDWIDGETREGISTRY_H
Provider interface to be implemented in order to introduce new kinds of embedded widgets for use in l...
virtual QString id() const =0
Unique name of the provider (among other providers)
virtual ~QgsLayerTreeEmbeddedWidgetProvider()=default
virtual QWidget * createWidget(QgsMapLayer *layer, int widgetIndex)=0
Factory to create widgets.
virtual QString name() const =0
Human readable name - may be translatable with tr()
virtual bool supportsLayer(QgsMapLayer *layer)=0
Whether it makes sense to use this widget for a particular layer.
Registry of widgets that may be embedded into layer tree view.
QgsLayerTreeEmbeddedWidgetRegistry & operator=(const QgsLayerTreeEmbeddedWidgetRegistry &other)=delete
QMap< QString, QgsLayerTreeEmbeddedWidgetProvider * > mProviders
storage of all the providers
QgsLayerTreeEmbeddedWidgetRegistry(const QgsLayerTreeEmbeddedWidgetRegistry &other)=delete
Base class for all map layer types.
Definition qgsmaplayer.h:76
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76