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.
New in version 3.0: Enums
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.
Signals
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.
-
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.
-
form
(self) → QgsAttributeForm¶ The form on which this widget is shown.
-
layer
(self) → QgsVectorLayer¶ The layer for which this widget and its form is shown.
-
mode
(self) → QgsAttributeFormWidget.Mode¶ Returns the current mode for the widget.
See also
-
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.
-
searchWidgetWrappers
(self) → object¶ 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
-
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 – 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.
-
setSearchWidgetWrapper
(self, wrapper: QgsSearchWidgetWrapper)¶ Sets the search widget wrapper for the widget used when the form is in search mode.
- Parameters
wrapper – search widget wrapper.
Note
the search widget wrapper should be created using searchWidgetFrame() as its parent
Note
this method is in place for unit testing only, and is not considered stable API
-