QgsAttributeFormWidget class
Base class for all widgets shown on a QgsAttributeForm.
Contents
Consists of the widget which is visible in edit mode as well as the widget visible in search mode.
Derived classes
- class QgsAttributeFormEditorWidget
- 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.
- class QgsAttributeFormRelationEditorWidget
- Widget to show for child relations on an attribute form.
Public types
- enum Mode { DefaultMode, MultiEditMode, SearchMode, AggregateSearchMode }
- Widget modes.
Constructors, destructors, conversion operators
- QgsAttributeFormWidget(QgsWidgetWrapper* widget, QgsAttributeForm* form) explicit
- A new form widget for the wrapper widget on form.
Public functions
- void addAdditionalSearchWidgetWrapper(QgsSearchWidgetWrapper* wrapper)
- Adds an additional search widget wrapper.
- void createSearchWidgetWrappers(const QgsAttributeEditorContext& context = QgsAttributeEditorContext()) pure virtual
- Creates the search widget wrappers for the widget used when the form is in search mode.
- auto currentFilterExpression() const -> QString virtual
- Creates an expression matching the current search filter value and search properties represented in the widget.
- auto form() const -> QgsAttributeForm*
- The form on which this widget is shown.
- auto layer() -> QgsVectorLayer*
- The layer for which this widget and its form is shown.
- auto mode() const -> Mode
- Returns the current mode for the widget.
- void resetSearch()
- Resets the search/filter value of the widget.
- auto searchWidgetFrame() -> QWidget*
- Returns the widget which should be used as a parent during construction of the search widget wrapper.
- auto searchWidgetToolButtonVisible() const -> bool
- The visibility of the search widget tool button, that allows (de)activating this search widgte or defines the comparison operator to use.
- auto searchWidgetWrappers() -> QList<QgsSearchWidgetWrapper*>
- Returns the search widget wrapper used in this widget.
- void setMode(Mode mode)
- Sets the current mode for the widget.
- void setSearchWidgetToolButtonVisible(bool searchWidgetToolButtonVisible)
- The visibility of the search widget tool button, that allows (de)activating this search widgte or defines the comparison operator to use.
- void setSearchWidgetWrapper(QgsSearchWidgetWrapper* wrapper)
- Sets the search widget wrapper for the widget used when the form is in search mode.
Protected functions
- auto editPage() const -> QWidget*
- Returns a pointer to the EDIT page widget.
- auto searchPage() const -> QWidget*
- Returns a pointer to the search page widget.
- auto stack() const -> QStackedWidget*
- Returns a pointer to the stacked widget managing edit and search page.
Enum documentation
enum QgsAttributeFormWidget:: Mode
Widget modes.
| Enumerators | |
|---|---|
| DefaultMode |
Default mode, only the editor widget is shown. |
| MultiEditMode |
Multi edit mode, both the editor widget and a QgsMultiEditToolButton is shown. |
| SearchMode |
Layer search/filter mode. |
| AggregateSearchMode |
Embedded in a search form, show additional aggregate function toolbutton. |
Function documentation
void QgsAttributeFormWidget:: addAdditionalSearchWidgetWrapper(QgsSearchWidgetWrapper* wrapper)
Adds an additional search widget wrapper.
Used to register a secondary search widget as used for "between" searches.
void QgsAttributeFormWidget:: createSearchWidgetWrappers(const QgsAttributeEditorContext& context = QgsAttributeEditorContext()) pure virtual
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) |
QString QgsAttributeFormWidget:: currentFilterExpression() const virtual
Creates an expression matching the current search filter value and search properties represented in the widget.
QWidget* QgsAttributeFormWidget:: searchWidgetFrame()
Returns the widget which should be used as a parent during construction of the search widget wrapper.
QList<QgsSearchWidgetWrapper*> QgsAttributeFormWidget:: searchWidgetWrappers()
Returns the search widget wrapper used in this widget.
The wrapper must first be created using createSearchWidgetWrapper()
void QgsAttributeFormWidget:: setSearchWidgetWrapper(QgsSearchWidgetWrapper* wrapper)
Sets the search widget wrapper for the widget used when the form is in search mode.
| Parameters | |
|---|---|
| wrapper | search widget wrapper. |
QWidget* QgsAttributeFormWidget:: editPage() const protected
Returns a pointer to the EDIT page widget.
QWidget* QgsAttributeFormWidget:: searchPage() const protected
Returns a pointer to the search page widget.
QStackedWidget* QgsAttributeFormWidget:: stack() const protected
Returns a pointer to the stacked widget managing edit and search page.