QgsAttributeFormEditorWidget class
A widget consisting of both an editor widget and additional widgets for controlling the behavior of the editor widget depending on a number of possible modes.
Contents
For instance, if the parent attribute form is in the multi edit mode, this widget will show both the editor widget and a tool button for controlling the multi edit results.
Base classes
- class QgsAttributeFormWidget
- Base class for all widgets shown on a QgsAttributeForm.
Constructors, destructors, conversion operators
- QgsAttributeFormEditorWidget(QgsEditorWidgetWrapper* editorWidget, const QString& widgetType, QgsAttributeForm* form) explicit
- Constructor for QgsAttributeFormEditorWidget.
Public functions
- void createSearchWidgetWrappers(const QgsAttributeEditorContext& context = QgsAttributeEditorContext()) override
- Creates the search widget wrappers for the widget used when the form is in search mode.
- auto currentValue() const -> QVariant
- Returns the current value of the attached editor widget.
- auto hasChanged() const -> bool
- Returns true if the widget's value has been changed since it was initialized.
- void initialize(const QVariant& initialValue, bool mixedValues = false)
- Resets the widget to an initial value.
- void setConstraintResultVisible(bool editable)
- Set the constraint result label visible or invisible according to the layer editable status.
-
void setConstraintStatus(const QString& constraint,
const QString& description,
const QString& err,
QgsEditorWidgetWrapper::
ConstraintResult result) - Set the constraint status for this widget.
Signals
- void valueChanged(const QVariant& value)
- Emitted when the widget's value changes.
Public slots
- void changesCommitted()
- Called when field values have been committed;.
- void setIsMixed(bool mixed)
- Sets whether the widget should be displayed in a "mixed values" mode.
Function documentation
QgsAttributeFormEditorWidget:: QgsAttributeFormEditorWidget(QgsEditorWidgetWrapper* editorWidget,
const QString& widgetType,
QgsAttributeForm* form) explicit
Constructor for QgsAttributeFormEditorWidget.
| Parameters | |
|---|---|
| editorWidget | associated editor widget wrapper (for default/edit modes) |
| widgetType | the type identifier of the widget passed in the wrapper |
| form | parent attribute form |
void QgsAttributeFormEditorWidget:: createSearchWidgetWrappers(const QgsAttributeEditorContext& context = QgsAttributeEditorContext()) override
Creates the search widget wrappers for the widget used when the form is in search mode.
| Parameters | |
|---|---|
| context | editor context (not available in Python bindings) |
bool QgsAttributeFormEditorWidget:: hasChanged() const
Returns true if the widget's value has been changed since it was initialized.
void QgsAttributeFormEditorWidget:: initialize(const QVariant& initialValue,
bool mixedValues = false)
Resets the widget to an initial value.
| Parameters | |
|---|---|
| initialValue | initial value to show in widget |
| mixedValues | set to true to initially show the mixed values state |
void QgsAttributeFormEditorWidget:: valueChanged(const QVariant& value) signal
Emitted when the widget's value changes.
| Parameters | |
|---|---|
| value | new widget value |
void QgsAttributeFormEditorWidget:: setIsMixed(bool mixed) public slot
Sets whether the widget should be displayed in a "mixed values" mode.
| Parameters | |
|---|---|
| mixed | set to true to show in a mixed values state |