QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgseditorwidgetregistry.h
Go to the documentation of this file.
1/***************************************************************************
2 qgseditorwidgetregistry.h
3 --------------------------------------
4 Date : 24.4.2013
5 Copyright : (C) 2013 Matthias Kuhn
6 Email : matthias at opengis dot ch
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 QGSEDITORWIDGETREGISTRY_H
17#define QGSEDITORWIDGETREGISTRY_H
18
19#include <QObject>
20#include "qgis_sip.h"
21#include <QMap>
25#include "qgis_gui.h"
26
27class QgsMapLayer;
28class QDomNode;
29class QgsMapCanvas;
30class QgsMessageBar;
34class QgsVectorLayer;
35
36
44class GUI_EXPORT QgsEditorWidgetRegistry : public QObject
45{
46 Q_OBJECT
47
48 public:
49
55
65 void initEditors( QgsMapCanvas *mapCanvas = nullptr, QgsMessageBar *messageBar = nullptr );
66
72 ~QgsEditorWidgetRegistry() override;
73
82 QgsEditorWidgetSetup findBest( const QgsVectorLayer *vl, const QString &fieldName ) const;
83
98 QgsEditorWidgetWrapper *create( const QString &widgetId,
100 int fieldIdx,
101 const QVariantMap &config,
102 QWidget *editor,
103 QWidget *parent SIP_TRANSFERTHIS,
105
119 int fieldIdx,
120 QWidget *editor,
121 QWidget *parent SIP_TRANSFERTHIS,
123
124 QgsSearchWidgetWrapper *createSearchWidget( const QString &widgetId,
125 QgsVectorLayer *vl,
126 int fieldIdx,
127 const QVariantMap &config,
128 QWidget *parent SIP_TRANSFERTHIS,
130
141 QgsEditorConfigWidget *createConfigWidget( const QString &widgetId, QgsVectorLayer *vl, int fieldIdx, QWidget *parent SIP_TRANSFERTHIS ) SIP_FACTORY;
142
150 QString name( const QString &widgetId );
151
157 QMap<QString, QgsEditorWidgetFactory *> factories();
158
164 QgsEditorWidgetFactory *factory( const QString &widgetId );
165
174 bool registerWidget( const QString &widgetId, QgsEditorWidgetFactory *widgetFactory SIP_TRANSFER );
175
181 void registerAutoConfPlugin( QgsEditorWidgetAutoConfPlugin *plugin ) { mAutoConf.registerPlugin( plugin ); }
182
183 private:
184 QString findSuitableWrapper( QWidget *editor, const QString &defaultWidget );
185
186 QMap<QString, QgsEditorWidgetFactory *> mWidgetFactories;
187 QMap<const char *, QPair<int, QString> > mFactoriesByType;
188 QgsEditorWidgetAutoConf mAutoConf;
189 std::unique_ptr<QgsEditorWidgetFactory> mFallbackWidgetFactory = nullptr;
190};
191
192#endif // QGSEDITORWIDGETREGISTRY_H
This class contains context information for attribute editor widgets.
This class should be subclassed for every configurable editor widget type.
Base class for plugins allowing to pick automatically a widget type for editing fields.
Every attribute editor widget needs a factory, which inherits this class.
This class manages all known edit widget factories.
void registerAutoConfPlugin(QgsEditorWidgetAutoConfPlugin *plugin)
Register a new auto-conf plugin.
Holder for the widget type and its configuration for a field.
Manages an editor widget Widget and wrapper share the same parent.
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:76
A bar for displaying non-blocking messages to the user.
Shows a search widget on a filter form.
Represents a vector layer which manages a vector based data sets.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_PYARGREMOVE
Definition qgis_sip.h:151
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76