QGIS API Documentation  3.6.0-Noosa (5873452)
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. More...
 
void addAdditionalSearchWidgetWrapper (QgsSearchWidgetWrapper *wrapper)
 Adds an additional search widget wrapper. More...
 
virtual void createSearchWidgetWrappers (const QgsAttributeEditorContext &context=QgsAttributeEditorContext())=0
 Creates the search widget wrappers for the widget used when the form is in search mode. More...
 
virtual QString currentFilterExpression () const
 Creates an expression matching the current search filter value and search properties represented in the widget. More...
 
QgsAttributeFormform () const
 The form on which this widget is shown. More...
 
QgsVectorLayerlayer ()
 The layer for which this widget and its form is shown. More...
 
Mode mode () const
 Returns the current mode for the widget. More...
 
void resetSearch ()
 Resets the search/filter value of the widget. More...
 
QWidget * searchWidgetFrame ()
 Returns the widget which should be used as a parent during construction of the search widget wrapper. More...
 
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. More...
 
QList< QgsSearchWidgetWrapper *> searchWidgetWrappers ()
 Returns the search widget wrapper used in this widget. More...
 
void setMode (Mode mode)
 Sets the current mode for the widget. More...
 
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. More...
 
void setSearchWidgetWrapper (QgsSearchWidgetWrapper *wrapper)
 Sets the search widget wrapper for the widget used when the form is in search mode. More...
 

Protected Member Functions

QWidget * editPage () const
 Returns a pointer to the EDIT page widget. More...
 
QWidget * searchPage () const
 Returns a pointer to the search page widget. More...
 
QStackedWidget * stack () const
 Returns a pointer to the stacked widget managing edit and search page. More...
 

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.

Since
QGIS 3.0

Definition at line 38 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 45 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.

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

Since
QGIS 2.16

Reimplemented in QgsAttributeFormRelationEditorWidget.

Definition at line 111 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 209 of file qgsattributeformwidget.cpp.

◆ form()

QgsAttributeForm * QgsAttributeFormWidget::form ( ) const

The form on which this widget is shown.

Definition at line 76 of file qgsattributeformwidget.cpp.

◆ layer()

QgsVectorLayer * QgsAttributeFormWidget::layer ( )

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

Definition at line 146 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 137 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 199 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 81 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 189 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 106 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 70 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 194 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 86 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 204 of file qgsattributeformwidget.cpp.


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