QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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

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 ( 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

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.

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.

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.

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.

QgsAttributeForm * QgsAttributeFormWidget::form ( ) const

The form on which this widget is shown.

Definition at line 76 of file qgsattributeformwidget.cpp.

QgsVectorLayer * QgsAttributeFormWidget::layer ( )

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

Definition at line 146 of file qgsattributeformwidget.cpp.

Mode QgsAttributeFormWidget::mode ( ) const
inline

Returns the current mode for the widget.

See also
setMode()

Definition at line 86 of file qgsattributeformwidget.h.

void QgsAttributeFormWidget::resetSearch ( )

Resets the search/filter value of the widget.

Definition at line 137 of file qgsattributeformwidget.cpp.

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.

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.

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.

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.

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.

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.

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.

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: