QGIS API Documentation
3.18.1-Zürich (202f1bf7e5)
|
This class manages all known edit widget factories. More...
#include <qgseditorwidgetregistry.h>
Public Member Functions | |
QgsEditorWidgetRegistry () | |
Constructor for QgsEditorWidgetRegistry. More... | |
~QgsEditorWidgetRegistry () override | |
Destructor. More... | |
QgsEditorWidgetWrapper * | create (const QString &widgetId, QgsVectorLayer *vl, int fieldIdx, const QVariantMap &config, QWidget *editor, QWidget *parent, const QgsAttributeEditorContext &context=QgsAttributeEditorContext()) |
Create an attribute editor widget wrapper of a given type for a given field. More... | |
QgsEditorWidgetWrapper * | create (QgsVectorLayer *vl, int fieldIdx, QWidget *editor, QWidget *parent, const QgsAttributeEditorContext &context=QgsAttributeEditorContext()) |
Create an attribute editor widget wrapper of the best type for a given field. More... | |
QgsEditorConfigWidget * | createConfigWidget (const QString &widgetId, QgsVectorLayer *vl, int fieldIdx, QWidget *parent) |
Creates a configuration widget. More... | |
QgsSearchWidgetWrapper * | createSearchWidget (const QString &widgetId, QgsVectorLayer *vl, int fieldIdx, const QVariantMap &config, QWidget *parent, const QgsAttributeEditorContext &context=QgsAttributeEditorContext()) |
QMap< QString, QgsEditorWidgetFactory * > | factories () |
Gets access to all registered factories. More... | |
QgsEditorWidgetFactory * | factory (const QString &widgetId) |
Gets a factory for the given widget type id. More... | |
QgsEditorWidgetSetup | findBest (const QgsVectorLayer *vl, const QString &fieldName) const |
Find the best editor widget and its configuration for a given field. More... | |
void | initEditors (QgsMapCanvas *mapCanvas=nullptr, QgsMessageBar *messageBar=nullptr) |
Registers all the default widgets. More... | |
QString | name (const QString &widgetId) |
Gets the human readable name for a widget type. More... | |
void | registerAutoConfPlugin (QgsEditorWidgetAutoConfPlugin *plugin) |
Register a new auto-conf plugin. More... | |
bool | registerWidget (const QString &widgetId, QgsEditorWidgetFactory *widgetFactory) |
Register a new widget factory with the given id. More... | |
This class manages all known edit widget factories.
QgsEditorWidgetRegistry is not usually directly created, but rather accessed through QgsGui::editorWidgetRegistry().
Definition at line 44 of file qgseditorwidgetregistry.h.
QgsEditorWidgetRegistry::QgsEditorWidgetRegistry | ( | ) |
Constructor for QgsEditorWidgetRegistry.
QgsEditorWidgetRegistry is not usually directly created, but rather accessed through QgsGui::editorWidgetRegistry().
Definition at line 45 of file qgseditorwidgetregistry.cpp.
|
override |
Destructor.
Deletes all the registered widgets
Definition at line 71 of file qgseditorwidgetregistry.cpp.
QgsEditorWidgetWrapper * QgsEditorWidgetRegistry::create | ( | const QString & | widgetId, |
QgsVectorLayer * | vl, | ||
int | fieldIdx, | ||
const QVariantMap & | config, | ||
QWidget * | editor, | ||
QWidget * | parent, | ||
const QgsAttributeEditorContext & | context = QgsAttributeEditorContext() |
||
) |
Create an attribute editor widget wrapper of a given type for a given field.
The editor may be nullptr
if you want the widget wrapper to create a default widget.
widgetId | The id of the widget type to create an attribute editor for |
vl | The vector layer for which this widget will be created |
fieldIdx | The field index on the specified layer for which this widget will be created |
config | A configuration which should be used for the widget creation |
editor | An editor widget which will be used instead of an autocreated widget |
parent | The parent which will be used for the created wrapper and the created widget |
context | The editor context (not available in Python bindings) |
Definition at line 97 of file qgseditorwidgetregistry.cpp.
QgsEditorWidgetWrapper * QgsEditorWidgetRegistry::create | ( | QgsVectorLayer * | vl, |
int | fieldIdx, | ||
QWidget * | editor, | ||
QWidget * | parent, | ||
const QgsAttributeEditorContext & | context = QgsAttributeEditorContext() |
||
) |
Create an attribute editor widget wrapper of the best type for a given field.
The editor may be nullptr
if you want the widget wrapper to create a default widget.
vl | The vector layer for which this widget will be created |
fieldIdx | The field index on the specified layer for which this widget will be created |
editor | An editor widget which will be used instead of an autocreated widget |
parent | The parent which will be used for the created wrapper and the created widget |
context | The editor context (not available in Python bindings) |
Definition at line 90 of file qgseditorwidgetregistry.cpp.
QgsEditorConfigWidget * QgsEditorWidgetRegistry::createConfigWidget | ( | const QString & | widgetId, |
QgsVectorLayer * | vl, | ||
int | fieldIdx, | ||
QWidget * | parent | ||
) |
Creates a configuration widget.
widgetId | The id of the widget type to create a configuration widget for |
vl | The vector layer for which this widget will be created |
fieldIdx | The field index on the specified layer for which this widget will be created |
parent | The parent widget for the created widget |
Definition at line 148 of file qgseditorwidgetregistry.cpp.
QgsSearchWidgetWrapper * QgsEditorWidgetRegistry::createSearchWidget | ( | const QString & | widgetId, |
QgsVectorLayer * | vl, | ||
int | fieldIdx, | ||
const QVariantMap & | config, | ||
QWidget * | parent, | ||
const QgsAttributeEditorContext & | context = QgsAttributeEditorContext() |
||
) |
Definition at line 128 of file qgseditorwidgetregistry.cpp.
QMap< QString, QgsEditorWidgetFactory * > QgsEditorWidgetRegistry::factories | ( | ) |
Gets access to all registered factories.
Definition at line 167 of file qgseditorwidgetregistry.cpp.
QgsEditorWidgetFactory * QgsEditorWidgetRegistry::factory | ( | const QString & | widgetId | ) |
Gets a factory for the given widget type id.
nullptr
if not existent Definition at line 172 of file qgseditorwidgetregistry.cpp.
QgsEditorWidgetSetup QgsEditorWidgetRegistry::findBest | ( | const QgsVectorLayer * | vl, |
const QString & | fieldName | ||
) | const |
Find the best editor widget and its configuration for a given field.
vl | The vector layer for which this widget will be created |
fieldName | The field name on the specified layer for which this widget will be created |
Definition at line 76 of file qgseditorwidgetregistry.cpp.
void QgsEditorWidgetRegistry::initEditors | ( | QgsMapCanvas * | mapCanvas = nullptr , |
QgsMessageBar * | messageBar = nullptr |
||
) |
Registers all the default widgets.
Only call this once on startup of an application.
mapCanvas | Specify a map canvas with which the widgets (relation reference) work |
messageBar | Specify a message bar on which messages by widgets will be shown while working with the map canvas |
Definition at line 50 of file qgseditorwidgetregistry.cpp.
QString QgsEditorWidgetRegistry::name | ( | const QString & | widgetId | ) |
Gets the human readable name for a widget type.
widgetId | The widget type to get the name for |
Definition at line 157 of file qgseditorwidgetregistry.cpp.
|
inline |
Register a new auto-conf plugin.
plugin | The plugin (ownership is transferred) |
Definition at line 182 of file qgseditorwidgetregistry.h.
bool QgsEditorWidgetRegistry::registerWidget | ( | const QString & | widgetId, |
QgsEditorWidgetFactory * | widgetFactory | ||
) |
Register a new widget factory with the given id.
widgetId | The id which will be used later to refer to this widget type |
widgetFactory | The factory which will create this widget type |
true
, if successful, false
, if the widgetId is already in use or widgetFactory is nullptr
Definition at line 177 of file qgseditorwidgetregistry.cpp.