QgsValueMapWidgetFactory class

Base classes

class QgsEditorWidgetFactory
Every attribute editor widget needs a factory, which inherits this class.

Constructors, destructors, conversion operators

QgsValueMapWidgetFactory(const QString& name)
Constructor for QgsValueMapWidgetFactory, where name is a human-readable name for the factory.

Public functions

auto configWidget(QgsVectorLayer* vl, int fieldIdx, QWidget* parent) const -> QgsEditorConfigWidget* override
Override this in your implementation.
auto create(QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent) const -> QgsEditorWidgetWrapper* override
Override this in your implementation.
auto createSearchWidget(QgsVectorLayer* vl, int fieldIdx, QWidget* parent) const -> QgsSearchWidgetWrapper* override
By default a simple QgsFilterLineEdit is returned as search widget.
auto supportedWidgetTypes() -> QHash<const char*, int> override
Returns a list of widget types which this editor widget supports.

Function documentation

QgsEditorConfigWidget* QgsValueMapWidgetFactory::configWidget(QgsVectorLayer* vl, int fieldIdx, QWidget* parent) const override

Override this in your implementation.

Parameters
vl The layer for which the widget will be created
fieldIdx The field index for which the widget will be created
parent The parent widget of the created config widget
Returns A configuration widget

Create a new configuration widget for this widget type.

QgsEditorWidgetWrapper* QgsValueMapWidgetFactory::create(QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent) const override

Override this in your implementation.

Parameters
vl The vector layer on which this widget will act
fieldIdx The field index on which this widget will act
editor An editor widget if already existent. If NULL is provided, a new widget will be created.
parent The parent for the wrapper class and any created widget.
Returns A new widget wrapper

Create a new editor widget wrapper. Call QgsEditorWidgetRegistry::create() instead of calling this method directly.

QgsSearchWidgetWrapper* QgsValueMapWidgetFactory::createSearchWidget(QgsVectorLayer* vl, int fieldIdx, QWidget* parent) const override

By default a simple QgsFilterLineEdit is returned as search widget.

Override in own factory to get something different than the default.

QHash<const char*, int> QgsValueMapWidgetFactory::supportedWidgetTypes() override

Returns a list of widget types which this editor widget supports.

Returns A map of widget type names and weight values

Each widget type can have a priority value attached, the factory with the highest one will be used.