QGIS API Documentation 3.35.0-Master (f6e073f0eed)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
QgsAttributeFormWidget Class Referenceabstract

Base class for all widgets shown on a QgsAttributeForm. More...

#include <qgsattributeformwidget.h>

Inheritance diagram for QgsAttributeFormWidget:
Inheritance graph
[legend]

Public Types

enum  Mode { DefaultMode , MultiEditMode , SearchMode , AggregateSearchMode }
 Widget modes. More...
 

Public Member Functions

 QgsAttributeFormWidget (QgsWidgetWrapper *widget, QgsAttributeForm *form)
 A new form widget for the wrapper widget on form.
 
 ~QgsAttributeFormWidget () override
 
void addAdditionalSearchWidgetWrapper (QgsSearchWidgetWrapper *wrapper)
 Adds an additional search widget wrapper.
 
virtual void createSearchWidgetWrappers (const QgsAttributeEditorContext &context=QgsAttributeEditorContext())=0
 Creates the search widget wrappers for the widget used when the form is in search mode.
 
virtual QString currentFilterExpression () const
 Creates an expression matching the current search filter value and search properties represented in the widget.
 
QgsAttributeFormform () const
 The form on which this widget is shown.
 
QgsVectorLayerlayer ()
 The layer for which this widget and its form is shown.
 
Mode mode () const
 Returns the current mode for the widget.
 
void resetSearch ()
 Resets the search/filter value of the widget.
 
QWidget * searchWidgetFrame ()
 Returns the widget which should be used as a parent during construction of the search widget wrapper.
 
bool searchWidgetToolButtonVisible () const
 The visibility of the search widget tool button, that allows (de)activating this search widgte or defines the comparison operator to use.
 
QList< QgsSearchWidgetWrapper * > searchWidgetWrappers ()
 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 Member Functions

QWidget * editPage () const
 Returns a pointer to the EDIT page widget.
 
QWidget * searchPage () const
 Returns a pointer to the search page widget.
 
void setVisiblePageForMode (QgsAttributeFormWidget::Mode mode)
 Sets the visible page in the widget to the page matching the specified mode.
 
QStackedWidget * stack () const
 Returns a pointer to the stacked widget managing edit and search page.
 

Detailed Description

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.

Definition at line 37 of file qgsattributeformwidget.h.

Member Enumeration Documentation

◆ Mode

Widget modes.

Enumerator
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.

Definition at line 44 of file qgsattributeformwidget.h.

Constructor & Destructor Documentation

◆ QgsAttributeFormWidget()

QgsAttributeFormWidget::QgsAttributeFormWidget ( QgsWidgetWrapper widget,
QgsAttributeForm form 
)
explicit

A new form widget for the wrapper widget on form.

Definition at line 22 of file qgsattributeformwidget.cpp.

◆ ~QgsAttributeFormWidget()

QgsAttributeFormWidget::~QgsAttributeFormWidget ( )
override

Definition at line 76 of file qgsattributeformwidget.cpp.

Member Function Documentation

◆ addAdditionalSearchWidgetWrapper()

void QgsAttributeFormWidget::addAdditionalSearchWidgetWrapper ( QgsSearchWidgetWrapper wrapper)

Adds an additional search widget wrapper.

Used to register a secondary search widget as used for "between" searches.

Definition at line 114 of file qgsattributeformwidget.cpp.

◆ createSearchWidgetWrappers()

virtual 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
contexteditor context (not available in Python bindings)

Implemented in QgsAttributeFormEditorWidget, and QgsAttributeFormRelationEditorWidget.

◆ currentFilterExpression()

QString QgsAttributeFormWidget::currentFilterExpression ( ) const
virtual

Creates an expression matching the current search filter value and search properties represented in the widget.

Reimplemented in QgsAttributeFormRelationEditorWidget.

Definition at line 127 of file qgsattributeformwidget.cpp.

◆ editPage()

QWidget * QgsAttributeFormWidget::editPage ( ) const
protected

Returns a pointer to the EDIT page widget.

Note
this method is in place for unit testing only, and is not considered stable API
not available in Python bindings

Definition at line 246 of file qgsattributeformwidget.cpp.

◆ form()

QgsAttributeForm * QgsAttributeFormWidget::form ( ) const

The form on which this widget is shown.

Definition at line 92 of file qgsattributeformwidget.cpp.

◆ layer()

QgsVectorLayer * QgsAttributeFormWidget::layer ( )

The layer for which this widget and its form is shown.

Definition at line 163 of file qgsattributeformwidget.cpp.

◆ mode()

Mode QgsAttributeFormWidget::mode ( ) const
inline

Returns the current mode for the widget.

See also
setMode()

Definition at line 86 of file qgsattributeformwidget.h.

◆ resetSearch()

void QgsAttributeFormWidget::resetSearch ( )

Resets the search/filter value of the widget.

Definition at line 153 of file qgsattributeformwidget.cpp.

◆ searchPage()

QWidget * QgsAttributeFormWidget::searchPage ( ) const
protected

Returns a pointer to the search page widget.

Note
this method is in place for unit testing only, and is not considered stable API
not available in Python bindings

Definition at line 236 of file qgsattributeformwidget.cpp.

◆ searchWidgetFrame()

QWidget * QgsAttributeFormWidget::searchWidgetFrame ( )

Returns the widget which should be used as a parent during construction of the search widget wrapper.

Note
this method is in place for unit testing only, and is not considered stable API

Definition at line 97 of file qgsattributeformwidget.cpp.

◆ searchWidgetToolButtonVisible()

bool QgsAttributeFormWidget::searchWidgetToolButtonVisible ( ) const

The visibility of the search widget tool button, that allows (de)activating this search widgte or defines the comparison operator to use.

Definition at line 226 of file qgsattributeformwidget.cpp.

◆ searchWidgetWrappers()

QList< QgsSearchWidgetWrapper * > QgsAttributeFormWidget::searchWidgetWrappers ( )

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

Definition at line 122 of file qgsattributeformwidget.cpp.

◆ setMode()

void QgsAttributeFormWidget::setMode ( QgsAttributeFormWidget::Mode  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
modewidget mode
See also
mode()

Definition at line 86 of file qgsattributeformwidget.cpp.

◆ setSearchWidgetToolButtonVisible()

void QgsAttributeFormWidget::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.

Definition at line 231 of file qgsattributeformwidget.cpp.

◆ setSearchWidgetWrapper()

void QgsAttributeFormWidget::setSearchWidgetWrapper ( QgsSearchWidgetWrapper wrapper)

Sets the search widget wrapper for the widget used when the form is in search mode.

Parameters
wrappersearch widget wrapper.
Note
the search widget wrapper should be created using searchWidgetFrame() as its parent
this method is in place for unit testing only, and is not considered stable API

Definition at line 102 of file qgsattributeformwidget.cpp.

◆ setVisiblePageForMode()

void QgsAttributeFormWidget::setVisiblePageForMode ( QgsAttributeFormWidget::Mode  mode)
protected

Sets the visible page in the widget to the page matching the specified mode.

Since
QGIS 3.32

Definition at line 193 of file qgsattributeformwidget.cpp.

◆ stack()

QStackedWidget * QgsAttributeFormWidget::stack ( ) const
protected

Returns a pointer to the stacked widget managing edit and search page.

Note
this method is in place for unit testing only, and is not considered stable API
not available in Python bindings

Definition at line 241 of file qgsattributeformwidget.cpp.


The documentation for this class was generated from the following files: