Class: QgsEditorWidgetRegistry¶
-
class
qgis.gui.
QgsEditorWidgetRegistry
¶ Bases:
PyQt5.QtCore.QObject
Constructor for QgsEditorWidgetRegistry. QgsEditorWidgetRegistry is not usually directly created, but rather accessed through
QgsGui.editorWidgetRegistry()
This class manages all known edit widget factories.
QgsEditorWidgetRegistry is not usually directly created, but rather accessed through
QgsGui.editorWidgetRegistry()
Enums
Methods
Create an attribute editor widget wrapper of a given type for a given field.
Creates a configuration widget
Gets access to all registered factories
Gets a factory for the given widget type id.
Find the best editor widget and its configuration for a given field.
Registers all the default widgets.
Gets the human readable name for a widget type
Register a new auto-conf plugin.
Register a new widget factory with the given id
Signals
Attributes
-
childEvent
()¶
-
connectNotify
()¶
-
create
(self, widgetId: str, vl: QgsVectorLayer, fieldIdx: int, config: Dict[str, Any], editor: QWidget, parent: QWidget) → QgsEditorWidgetWrapper¶ Create an attribute editor widget wrapper of a given type for a given field. The editor may be NULL if you want the widget wrapper to create a default widget.
- Parameters
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
- Returns
A new widget wrapper
create(self, vl: QgsVectorLayer, fieldIdx: int, editor: QWidget, parent: QWidget) -> QgsEditorWidgetWrapper Create an attribute editor widget wrapper of the best type for a given field. The editor may be NULL if you want the widget wrapper to create a default widget.
- Parameters
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
- Returns
A new widget wrapper
-
createConfigWidget
(self, widgetId: str, vl: QgsVectorLayer, fieldIdx: int, parent: QWidget) → QgsEditorConfigWidget¶ Creates a configuration widget
- Parameters
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
- Returns
A new configuration widget
-
createSearchWidget
(self, widgetId: str, vl: QgsVectorLayer, fieldIdx: int, config: Dict[str, Any], parent: QWidget) → QgsSearchWidgetWrapper¶
-
customEvent
()¶
-
disconnectNotify
()¶
-
factories
(self) → object¶ Gets access to all registered factories
- Returns
All ids and factories
-
factory
(self, widgetId: str) → QgsEditorWidgetFactory¶ Gets a factory for the given widget type id.
- Returns
A factory or Null if not existent
-
findBest
(self, vl: QgsVectorLayer, fieldName: str) → QgsEditorWidgetSetup¶ Find the best editor widget and its configuration for a given field.
- Parameters
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
- Returns
The id of the widget type to use and its config
-
initEditors
(self, mapCanvas: QgsMapCanvas = None, messageBar: QgsMessageBar = None)¶ Registers all the default widgets. Only call this once on startup of an application.
- Parameters
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
Note
Not required for plugins, the QGIS application does that already
New in version 2.8.
-
isSignalConnected
()¶
-
name
(self, widgetId: str) → str¶ Gets the human readable name for a widget type
- Parameters
widgetId – The widget type to get the name for
- Returns
A human readable name
-
receivers
()¶
-
registerAutoConfPlugin
(self, plugin: QgsEditorWidgetAutoConfPlugin)¶ Register a new auto-conf plugin.
- Parameters
plugin – The plugin (ownership is transferred)
-
registerWidget
(self, widgetId: str, widgetFactory: QgsEditorWidgetFactory) → bool¶ Register a new widget factory with the given id
- Parameters
widgetId – The id which will be used later to refer to this widget type
widgetFactory – The factory which will create this widget type
- Returns
true, if successful, false, if the widgetId is already in use or widgetFactory is NULL
-
sender
()¶
-
senderSignalIndex
()¶
-
timerEvent
()¶
-