Class: QgsAttributeFormWidget¶
- class qgis.gui.QgsAttributeFormWidget(widget: QgsWidgetWrapper, form: QgsAttributeForm)¶
Bases:
PyQt5.QtWidgets.QWidget
A new form widget for the wrapper
widget
onform
.Base class for all widgets shown on a
QgsAttributeForm
. Consists of the widget which is visible in edit mode as well as the widget visible in search mode.Methods
Adds an additional search widget wrapper.
Creates the search widget wrappers for the widget used when the form is in search mode.
Creates an expression matching the current search filter value and search properties represented in the widget.
The form on which this widget is shown.
The layer for which this widget and its form is shown.
Returns the current mode for the widget.
Resets the search/filter value of the widget.
The visibility of the search widget tool button, that allows (de)activating this search widgte or defines the comparison operator to use.
Returns the search widget wrapper used in this widget.
Sets the current mode for the widget.
The visibility of the search widget tool button, that allows (de)activating this search widgte or defines the comparison operator to use.
Sets the search widget wrapper for the widget used when the form is in search mode.
Attributes
- AggregateSearchMode = 3¶
- DefaultMode = 0¶
- class Mode¶
Bases:
int
- MultiEditMode = 1¶
- SearchMode = 2¶
- addAdditionalSearchWidgetWrapper(self, wrapper: QgsSearchWidgetWrapper)¶
Adds an additional search widget wrapper. Used to register a secondary search widget as used for “between” searches.
- Parameters
wrapper (QgsSearchWidgetWrapper) –
- createSearchWidgetWrappers(self)¶
Creates the search widget wrappers for the widget used when the form is in search mode.
- currentFilterExpression(self) → str¶
Creates an expression matching the current search filter value and search properties represented in the widget.
New in version 2.16.
- Return type
str
- form(self) → QgsAttributeForm¶
The form on which this widget is shown.
- Return type
- layer(self) → QgsVectorLayer¶
The layer for which this widget and its form is shown.
- Return type
- mode(self) → QgsAttributeFormWidget.Mode¶
Returns the current mode for the widget.
See also
- Return type
- resetSearch(self)¶
Resets the search/filter value of the widget.
- searchWidgetToolButtonVisible(self) → bool¶
The visibility of the search widget tool button, that allows (de)activating this search widgte or defines the comparison operator to use.
- Return type
bool
- searchWidgetWrappers(self) → List[QgsSearchWidgetWrapper]¶
Returns the search widget wrapper used in this widget. The wrapper must first be created using
createSearchWidgetWrapper()
Note
this method is in place for unit testing only, and is not considered stable API
- Return type
List[QgsSearchWidgetWrapper]
- setMode(self, mode: QgsAttributeFormWidget.Mode)¶
Sets the current mode for the widget. The widget will adapt its state and visible widgets to reflect the updated mode. For example, showing multi edit tool buttons if the mode is set to MultiEditMode.
- Parameters
mode (QgsAttributeFormWidget.Mode) – widget mode
See also
- setSearchWidgetToolButtonVisible(self, searchWidgetToolButtonVisible: bool)¶
The visibility of the search widget tool button, that allows (de)activating this search widgte or defines the comparison operator to use.
- Parameters
searchWidgetToolButtonVisible (bool) –
- setSearchWidgetWrapper(self, wrapper: QgsSearchWidgetWrapper)¶
Sets the search widget wrapper for the widget used when the form is in search mode.
- Parameters
wrapper (QgsSearchWidgetWrapper) – search widget wrapper.
Note
the search widget wrapper should be created using
searchWidgetFrame()
as its parentNote
this method is in place for unit testing only, and is not considered stable API