QGIS API Documentation  2.99.0-Master (9fdd060)
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsAttributeFormEditorWidget Class Reference

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

#include <qgsattributeformeditorwidget.h>

Inheritance diagram for QgsAttributeFormEditorWidget:
Inheritance graph
[legend]

Public Types

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

Public Slots

void changesCommitted ()
 Called when field values have been committed;. More...
 
void resetSearch ()
 Resets the search/filter value of the widget. More...
 
void setIsMixed (bool mixed)
 Sets whether the widget should be displayed in a "mixed values" mode. More...
 

Signals

void valueChanged (const QVariant &value)
 Emitted when the widget's value changes. More...
 

Public Member Functions

 QgsAttributeFormEditorWidget (QgsEditorWidgetWrapper *editorWidget, QgsAttributeForm *form)
 Constructor for QgsAttributeFormEditorWidget. More...
 
 ~QgsAttributeFormEditorWidget ()
 
void createSearchWidgetWrappers (const QString &widgetId, int fieldIdx, const QVariantMap &config, const QgsAttributeEditorContext &context=QgsAttributeEditorContext())
 Creates the search widget wrappers for the widget used when the form is in search mode. More...
 
QString currentFilterExpression () const
 Creates an expression matching the current search filter value and search properties represented in the widget. More...
 
QVariant currentValue () const
 Returns the current value of the attached editor widget. More...
 
bool hasChanged () const
 Returns true if the widget's value has been changed since it was initialized. More...
 
void initialize (const QVariant &initialValue, bool mixedValues=false)
 Resets the widget to an initial value. More...
 
Mode mode () const
 Returns the current mode for the widget. More...
 
void setMode (Mode mode)
 Sets the current mode for the widget. More...
 

Protected Member Functions

QWidget * searchWidgetFrame ()
 Returns the widget which should be used as a parent during construction of the search widget wrapper. More...
 
QgsSearchWidgetToolButtonsearchWidgetToolButton ()
 Returns a pointer to the search widget tool button in the widget. More...
 
QList< QgsSearchWidgetWrapper *> searchWidgetWrappers ()
 Returns the search widget wrapper used in this widget. More...
 
void setSearchWidgetWrapper (QgsSearchWidgetWrapper *wrapper)
 Sets the search widget wrapper for the widget used when the form is in search mode. More...
 

Detailed Description

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.

For instance, if the parent attribute form is in the multi edit mode, this widget will show both the editor widget and a tool button for controlling the multi edit results.

Since
QGIS 2.16

Definition at line 44 of file qgsattributeformeditorwidget.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.

Definition at line 51 of file qgsattributeformeditorwidget.h.

Constructor & Destructor Documentation

◆ QgsAttributeFormEditorWidget()

QgsAttributeFormEditorWidget::QgsAttributeFormEditorWidget ( QgsEditorWidgetWrapper editorWidget,
QgsAttributeForm form 
)
explicit

Constructor for QgsAttributeFormEditorWidget.

Parameters
editorWidgetassociated editor widget wrapper (for default/edit modes)
formparent attribute form

Definition at line 29 of file qgsattributeformeditorwidget.cpp.

◆ ~QgsAttributeFormEditorWidget()

QgsAttributeFormEditorWidget::~QgsAttributeFormEditorWidget ( )

Definition at line 92 of file qgsattributeformeditorwidget.cpp.

Member Function Documentation

◆ changesCommitted

void QgsAttributeFormEditorWidget::changesCommitted ( )
slot

Called when field values have been committed;.

Definition at line 151 of file qgsattributeformeditorwidget.cpp.

◆ createSearchWidgetWrappers()

void QgsAttributeFormEditorWidget::createSearchWidgetWrappers ( const QString &  widgetId,
int  fieldIdx,
const QVariantMap &  config,
const QgsAttributeEditorContext context = QgsAttributeEditorContext() 
)

Creates the search widget wrappers for the widget used when the form is in search mode.

Parameters
widgetIdid of the widget type to create a search wrapper for
fieldIdxindex of field associated with widget
configconfiguration which should be used for the widget creation
contexteditor context (not available in Python bindings)

Definition at line 98 of file qgsattributeformeditorwidget.cpp.

◆ currentFilterExpression()

QString QgsAttributeFormEditorWidget::currentFilterExpression ( ) const

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

Since
QGIS 2.16

Definition at line 189 of file qgsattributeformeditorwidget.cpp.

◆ currentValue()

QVariant QgsAttributeFormEditorWidget::currentValue ( ) const

Returns the current value of the attached editor widget.

Definition at line 184 of file qgsattributeformeditorwidget.cpp.

◆ hasChanged()

bool QgsAttributeFormEditorWidget::hasChanged ( ) const
inline

Returns true if the widget's value has been changed since it was initialized.

See also
initialize()

Definition at line 105 of file qgsattributeformeditorwidget.h.

◆ initialize()

void QgsAttributeFormEditorWidget::initialize ( const QVariant &  initialValue,
bool  mixedValues = false 
)

Resets the widget to an initial value.

Parameters
initialValueinitial value to show in widget
mixedValuesset to true to initially show the mixed values state

Definition at line 170 of file qgsattributeformeditorwidget.cpp.

◆ mode()

Mode QgsAttributeFormEditorWidget::mode ( ) const
inline

Returns the current mode for the widget.

See also
setMode()

Definition at line 92 of file qgsattributeformeditorwidget.h.

◆ resetSearch

void QgsAttributeFormEditorWidget::resetSearch ( )
slot

Resets the search/filter value of the widget.

Definition at line 161 of file qgsattributeformeditorwidget.cpp.

◆ searchWidgetFrame()

QWidget * QgsAttributeFormEditorWidget::searchWidgetFrame ( )
protected

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 AP

Definition at line 127 of file qgsattributeformeditorwidget.cpp.

◆ searchWidgetToolButton()

QgsSearchWidgetToolButton * QgsAttributeFormEditorWidget::searchWidgetToolButton ( )
protected

Returns a pointer to the search widget tool button in the widget.

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

Definition at line 281 of file qgsattributeformeditorwidget.cpp.

◆ searchWidgetWrappers()

QList< QgsSearchWidgetWrapper *> QgsAttributeFormEditorWidget::searchWidgetWrappers ( )
protected

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 AP

Definition at line 132 of file qgsattributeformeditorwidget.cpp.

◆ setIsMixed

void QgsAttributeFormEditorWidget::setIsMixed ( bool  mixed)
slot

Sets whether the widget should be displayed in a "mixed values" mode.

Parameters
mixedset to true to show in a mixed values state

Definition at line 143 of file qgsattributeformeditorwidget.cpp.

◆ setMode()

void QgsAttributeFormEditorWidget::setMode ( QgsAttributeFormEditorWidget::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 137 of file qgsattributeformeditorwidget.cpp.

◆ setSearchWidgetWrapper()

void QgsAttributeFormEditorWidget::setSearchWidgetWrapper ( QgsSearchWidgetWrapper wrapper)
protected

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 AP

Definition at line 115 of file qgsattributeformeditorwidget.cpp.

◆ valueChanged

void QgsAttributeFormEditorWidget::valueChanged ( const QVariant &  value)
signal

Emitted when the widget's value changes.

Parameters
valuenew widget value

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