QgsEditorConfigWidget class

This class should be subclassed for every configurable editor widget type.

It implements the GUI configuration widget and transforms this to/from a configuration.

It will only be instantiated by {

Base classes

class QgsExpressionContextGenerator
Abstract interface for generating an expression context.

Derived classes

class QgsCheckBoxConfigDlg
class QgsDateTimeEditConfig
class QgsDummyConfigDlg
class QgsExternalResourceConfigDlg
class QgsRangeConfigDlg
class QgsRelationReferenceConfigDlg
class QgsTextEditConfigDlg
class QgsUniqueValuesConfigDlg
class QgsValueMapConfigDlg
class QgsValueRelationConfigDlg

Constructors, destructors, conversion operators

QgsEditorConfigWidget(QgsVectorLayer* vl, int fieldIdx, QWidget* parent) explicit
Create a new configuration widget.

Public functions

auto config() -> QVariantMap pure virtual
Create a configuration from the current GUI state.
auto createExpressionContext() const -> QgsExpressionContext override
This method needs to be reimplemented in all classes which implement this interface and return an expression context.
auto field() -> int
Returns the field for which this configuration widget applies.
auto layer() -> QgsVectorLayer*
Returns the layer for which this configuration widget applies.
void setConfig(const QVariantMap& config) pure virtual
Update the configuration widget to represent the given configuration.

Signals

void changed()
Emitted when the configuration of the widget is changed.

Protected functions

void initializeDataDefinedButton(QgsPropertyOverrideButton* button, QgsWidgetWrapper::Property key)
Registers a property override button, setting up its initial value, connections and description.
void updateDataDefinedButton(QgsPropertyOverrideButton* button)
Updates a specific property override button to reflect the widgets's current properties.
void updateDataDefinedButtons()
Updates all property override buttons to reflect the widgets's current properties.

Protected variables

QgsPropertyCollection mPropertyCollection
Temporary property collection for config widgets.

Function documentation

QgsEditorConfigWidget::QgsEditorConfigWidget(QgsVectorLayer* vl, int fieldIdx, QWidget* parent) explicit

Create a new configuration widget.

Parameters
vl The layer for which the configuration dialog will be created
fieldIdx The index of the field on the layer for which this dialog will be created
parent A parent widget

QVariantMap QgsEditorConfigWidget::config() pure virtual

Create a configuration from the current GUI state.

Returns A widget configuration

QgsExpressionContext QgsEditorConfigWidget::createExpressionContext() const override

This method needs to be reimplemented in all classes which implement this interface and return an expression context.

int QgsEditorConfigWidget::field()

Returns the field for which this configuration widget applies.

Returns The field index

QgsVectorLayer* QgsEditorConfigWidget::layer()

Returns the layer for which this configuration widget applies.

Returns The layer

void QgsEditorConfigWidget::setConfig(const QVariantMap& config) pure virtual

Update the configuration widget to represent the given configuration.

Parameters
config The configuration which should be represented by this widget

void QgsEditorConfigWidget::changed() signal

Emitted when the configuration of the widget is changed.

void QgsEditorConfigWidget::initializeDataDefinedButton(QgsPropertyOverrideButton* button, QgsWidgetWrapper::Property key) protected

Registers a property override button, setting up its initial value, connections and description.

Parameters
button button to register
key corresponding data defined property key