QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
Public Slots | Signals | Public Member Functions | Friends | 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 Slots

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

Signals

Q_DECL_DEPRECATED void valueChanged (const QVariant &value)
 Emitted when the widget's value changes. More...
 
void valuesChanged (const QVariant &value, const QVariantList &additionalFieldValues)
 Emitted when the widget's value changes. More...
 

Public Member Functions

 QgsAttributeFormEditorWidget (QgsEditorWidgetWrapper *editorWidget, const QString &widgetType, QgsAttributeForm *form)
 Constructor for QgsAttributeFormEditorWidget. More...
 
 ~QgsAttributeFormEditorWidget () override
 
void createSearchWidgetWrappers (const QgsAttributeEditorContext &context=QgsAttributeEditorContext()) override
 Creates the search widget wrappers for the widget used when the form is in search mode. More...
 
QVariant currentValue () const
 Returns the current value of the attached editor widget. More...
 
QgsEditorWidgetWrappereditorWidget () const
 Returns the editor widget wrapper. 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, const QVariantList &additionalFieldValues=QVariantList())
 Resets the widget to an initial value. More...
 
void setConstraintResultVisible (bool editable)
 Set the constraint result label visible or invisible according to the layer editable status. More...
 
void setConstraintStatus (const QString &constraint, const QString &description, const QString &err, QgsEditorWidgetWrapper::ConstraintResult result)
 Set the constraint status for this widget. More...
 
- Public Member Functions inherited from QgsAttributeFormWidget
 QgsAttributeFormWidget (QgsWidgetWrapper *widget, QgsAttributeForm *form)
 A new form widget for the wrapper widget on form. More...
 
 ~QgsAttributeFormWidget () override
 
void addAdditionalSearchWidgetWrapper (QgsSearchWidgetWrapper *wrapper)
 Adds an additional search widget wrapper. 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...
 

Friends

class TestQgsAttributeForm
 

Additional Inherited Members

- Public Types inherited from QgsAttributeFormWidget
enum  Mode { DefaultMode , MultiEditMode , SearchMode , AggregateSearchMode }
 Widget modes. More...
 
- Protected Member Functions inherited from QgsAttributeFormWidget
QWidget * editPage () const
 Returns a pointer to the EDIT page widget. More...
 
QWidget * searchPage () const
 Returns a pointer to the search page widget. More...
 
void setVisiblePageForMode (QgsAttributeFormWidget::Mode mode)
 Sets the visible page in the widget to the page matching the specified mode. More...
 
QStackedWidget * stack () const
 Returns a pointer to the stacked widget managing edit and search page. 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.

Definition at line 41 of file qgsattributeformeditorwidget.h.

Constructor & Destructor Documentation

◆ QgsAttributeFormEditorWidget()

QgsAttributeFormEditorWidget::QgsAttributeFormEditorWidget ( QgsEditorWidgetWrapper editorWidget,
const QString &  widgetType,
QgsAttributeForm form 
)
explicit

Constructor for QgsAttributeFormEditorWidget.

Parameters
editorWidgetassociated editor widget wrapper (for default/edit modes)
widgetTypethe type identifier of the widget passed in the wrapper
formparent attribute form

Definition at line 31 of file qgsattributeformeditorwidget.cpp.

◆ ~QgsAttributeFormEditorWidget()

QgsAttributeFormEditorWidget::~QgsAttributeFormEditorWidget ( )
override

Definition at line 65 of file qgsattributeformeditorwidget.cpp.

Member Function Documentation

◆ changesCommitted

void QgsAttributeFormEditorWidget::changesCommitted ( )
slot

Called when field values have been committed;.

Definition at line 130 of file qgsattributeformeditorwidget.cpp.

◆ createSearchWidgetWrappers()

void QgsAttributeFormEditorWidget::createSearchWidgetWrappers ( const QgsAttributeEditorContext context = QgsAttributeEditorContext())
overridevirtual

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

Parameters
contexteditor context (not available in Python bindings)

Implements QgsAttributeFormWidget.

Definition at line 71 of file qgsattributeformeditorwidget.cpp.

◆ currentValue()

QVariant QgsAttributeFormEditorWidget::currentValue ( ) const

Returns the current value of the attached editor widget.

Definition at line 161 of file qgsattributeformeditorwidget.cpp.

◆ editorWidget()

QgsEditorWidgetWrapper * QgsAttributeFormEditorWidget::editorWidget ( ) const

Returns the editor widget wrapper.

Since
QGIS 3.10

Definition at line 117 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 73 of file qgsattributeformeditorwidget.h.

◆ initialize()

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

Resets the widget to an initial value.

Parameters
initialValueinitial value to show in widget
mixedValuesset to true to initially show the mixed values state
additionalFieldValuesa variant map of additional field names with their corresponding values

Definition at line 145 of file qgsattributeformeditorwidget.cpp.

◆ setConstraintResultVisible()

void QgsAttributeFormEditorWidget::setConstraintResultVisible ( bool  editable)

Set the constraint result label visible or invisible according to the layer editable status.

Definition at line 112 of file qgsattributeformeditorwidget.cpp.

◆ setConstraintStatus()

void QgsAttributeFormEditorWidget::setConstraintStatus ( const QString &  constraint,
const QString &  description,
const QString &  err,
QgsEditorWidgetWrapper::ConstraintResult  result 
)

Set the constraint status for this widget.

Definition at line 91 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 122 of file qgsattributeformeditorwidget.cpp.

◆ valueChanged

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

Emitted when the widget's value changes.

Parameters
valuenew widget value
Deprecated:
since QGIS 3.10 use valuesChanged instead

◆ valuesChanged

void QgsAttributeFormEditorWidget::valuesChanged ( const QVariant &  value,
const QVariantList &  additionalFieldValues 
)
signal

Emitted when the widget's value changes.

Parameters
valuenew widget value
additionalFieldValuesof the potential additional fields
Since
QGIS 3.10

Friends And Related Function Documentation

◆ TestQgsAttributeForm

friend class TestQgsAttributeForm
friend

Definition at line 155 of file qgsattributeformeditorwidget.h.


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